From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40647) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VgZBE-00080W-7i for qemu-devel@nongnu.org; Wed, 13 Nov 2013 07:04:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VgZB8-0004Dn-8v for qemu-devel@nongnu.org; Wed, 13 Nov 2013 07:04:20 -0500 Message-ID: <52836AB8.3020409@redhat.com> Date: Wed, 13 Nov 2013 13:04:08 +0100 From: Paolo Bonzini 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> In-Reply-To: <5282E6B5.4090802@ozlabs.ru> 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: Alexey Kardashevskiy Cc: Alexander Graf , qemu-ppc@nongnu.org, =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= , qemu-devel@nongnu.org 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. 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.