From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35636) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VAM5t-0006zn-Kg for qemu-devel@nongnu.org; Fri, 16 Aug 2013 11:37:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VAM5n-0000qJ-Kq for qemu-devel@nongnu.org; Fri, 16 Aug 2013 11:37:41 -0400 Message-ID: <1376667453.28796.0.camel@ul30vt.home> From: Alex Williamson Date: Fri, 16 Aug 2013 09:37:33 -0600 In-Reply-To: <520E44CA.6050205@twiddle.net> References: <20130816124915.12577.72732.stgit@bling.home> <520E44CA.6050205@twiddle.net> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2] exec: Fix non-power-of-2 sized accesses List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Henderson Cc: lersek@redhat.com, qemu-devel@nongnu.org, qemu-stable@nongnu.org On Fri, 2013-08-16 at 08:27 -0700, Richard Henderson wrote: > On 08/16/2013 05:50 AM, Alex Williamson wrote: > > + /* Size must be a power of 2 */ > > + if (l & (l - 1)) { > > + while (l & (access_size_max - 1)) { > > + access_size_max >>= 1; > > + } > > + } > > + > > Why the loop at all? x & -x extracts the lsb of x. l = 5, we want 4, not 1. Thanks, Alex