From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=48234 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oz7pM-0007zi-Tk for qemu-devel@nongnu.org; Fri, 24 Sep 2010 08:56:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Oz7pL-0001Hj-Nx for qemu-devel@nongnu.org; Fri, 24 Sep 2010 08:56:36 -0400 Received: from mail-yw0-f45.google.com ([209.85.213.45]:47812) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oz7pL-0001Hb-Ft for qemu-devel@nongnu.org; Fri, 24 Sep 2010 08:56:35 -0400 Received: by ywg4 with SMTP id 4so1259452ywg.4 for ; Fri, 24 Sep 2010 05:56:34 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <4C9C9FFD.4070604@redhat.com> Date: Fri, 24 Sep 2010 14:56:29 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1285256514-21138-1-git-send-email-stefanha@linux.vnet.ibm.com> <1285256514-21138-2-git-send-email-stefanha@linux.vnet.ibm.com> <20100924083748.GA2218@stefan-thinkpad.transitives.com> In-Reply-To: <20100924083748.GA2218@stefan-thinkpad.transitives.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH 1/7] qcow2: Make get_bits_from_size() common List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Kevin Wolf , Anthony Liguori , qemu-devel@nongnu.org, Avi Kivity , Christoph Hellwig On 09/24/2010 10:37 AM, Stefan Hajnoczi wrote: > On Fri, Sep 24, 2010 at 01:50:39AM +0400, malc wrote: >> On Thu, 23 Sep 2010, Stefan Hajnoczi wrote: >> >>> The get_bits_from_size() calculates the log base-2 of a number. This is >>> useful in bit manipulation code working with power-of-2s. >>> >>> Currently used by qcow2 and needed by qed in a follow-on patch. >> >> int ilog2 (size_t size) >> { >> if (size& (size - 1)) >> return -1; >> >> return __builtin_ctzl (size); >> } >> >> Ifdef WIN64 omitted for brevity. > > What is the situation with WIN64? long is only 32 bit, so you need __builtin_ctzll. Paolo