From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36849) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VAMBH-0002Di-SG for qemu-devel@nongnu.org; Fri, 16 Aug 2013 11:43:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VAMBB-0002aF-Uc for qemu-devel@nongnu.org; Fri, 16 Aug 2013 11:43:15 -0400 Message-ID: <1376667787.28796.1.camel@ul30vt.home> From: Alex Williamson Date: Fri, 16 Aug 2013 09:43:07 -0600 In-Reply-To: <1376667453.28796.0.camel@ul30vt.home> References: <20130816124915.12577.72732.stgit@bling.home> <520E44CA.6050205@twiddle.net> <1376667453.28796.0.camel@ul30vt.home> 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 09:37 -0600, Alex Williamson wrote: > 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, Which is not what my patch does either :-\