From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32994) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VALvr-0007xe-Tp for qemu-devel@nongnu.org; Fri, 16 Aug 2013 11:27:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VALvj-0005pu-DT for qemu-devel@nongnu.org; Fri, 16 Aug 2013 11:27:19 -0400 Sender: Richard Henderson Message-ID: <520E44CA.6050205@twiddle.net> Date: Fri, 16 Aug 2013 08:27:06 -0700 From: Richard Henderson MIME-Version: 1.0 References: <20130816124915.12577.72732.stgit@bling.home> In-Reply-To: <20130816124915.12577.72732.stgit@bling.home> Content-Type: text/plain; charset=UTF-8 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: Alex Williamson Cc: lersek@redhat.com, qemu-devel@nongnu.org, qemu-stable@nongnu.org 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. r~