From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42500) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vgpqe-0003HF-6H for qemu-devel@nongnu.org; Thu, 14 Nov 2013 00:52:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VgpqV-0006CV-Ej for qemu-devel@nongnu.org; Thu, 14 Nov 2013 00:52:12 -0500 Received: from mail-pa0-f53.google.com ([209.85.220.53]:44433) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VgpqV-0006CK-8c for qemu-devel@nongnu.org; Thu, 14 Nov 2013 00:52:03 -0500 Received: by mail-pa0-f53.google.com with SMTP id kq14so1573341pab.26 for ; Wed, 13 Nov 2013 21:52:02 -0800 (PST) Message-ID: <528464FB.1050009@ozlabs.ru> Date: Thu, 14 Nov 2013 16:51:55 +1100 From: Alexey Kardashevskiy MIME-Version: 1.0 References: <1384155875-26999-1-git-send-email-aik@ozlabs.ru> <1384155875-26999-6-git-send-email-aik@ozlabs.ru> <5280C629.9010704@suse.de> <5282E6B5.4090802@ozlabs.ru> <52836AB8.3020409@redhat.com> In-Reply-To: <52836AB8.3020409@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v3 5/6] bitops: add BITNR macro List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Alexander Graf , qemu-ppc@nongnu.org, =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= , qemu-devel@nongnu.org On 11/13/2013 11:04 PM, Paolo Bonzini wrote: > Il 13/11/2013 03:40, Alexey Kardashevskiy ha scritto: >> I looked further and did not find any use of ffs/clz so I wonder what did >> you mean about bitops.h and what did I miss? I am confused. > > It's host-utils.h actually. The reason for the wrappers is twofold: > > (1) provide 32/64-bit functions instead of int/long/longlong; > > (2) support GCC <3.4. > > The wrappers are not usable where you have constant expressions as in > your case. So your original patch is good IMO, except for the __ at the > beginning of __BITNR. There are 2 macros, one (BITNR) uses the other (__BITNR). What would the good name be for BITNR then? > > Paolo > >> So I would suggest the following instead (if I really needed this BITNR but >> I really do not :) ) >> >> === >> bitops: add BITNR macro >> >> This adds a macro to calculate the highest single bit set. If more than >> one bit is set, returns -1. > -- Alexey