[ovs-dev] [PATCH 2/2] util: Make popcount() handle 64-bit integers, not separate popcount64().

YAMAMOTO Takashi yamamoto at valinux.co.jp
Tue Nov 19 08:14:14 UTC 2013


> On Tue, Nov 19, 2013 at 02:49:53PM +0900, YAMAMOTO Takashi wrote:
>> > On Tue, Nov 19, 2013 at 11:20:44AM +0900, YAMAMOTO Takashi wrote:
>> >> > Having a single function that can do popcount() on any integer type is
>> >> > easier for callers to get right.  The implementation is probably slower
>> >> > if the caller actually provides a 32-bit (or shorter) integer, but the
>> >> > only existing callers always provide a full 64-bit integer so this seems
>> >> > unimportant for now.
>> >> > 
>> >> > This also restores use, in practice, of the optimized implementation of
>> >> > population count.  (As the comment on popcount32() says, this version is
>> >> > 2x faster than __builtin_popcount().)
>> >> 
>> >> this breaks NetBSD builds.
>> >> 
>> >> gcc -DHAVE_CONFIG_H -I.   -I ./include -I ./lib -I ./lib   -Wstrict-prototypes -Wall -Wextra -Wno-sign-compare -Wpointer-arith -Wdeclaration-after-statement -Wno-format-zero-length -Wswitch-enum -Wunused-parameter -Wstrict-aliasing -Wbad-function-cast -Wcast-align -Wmissing-prototypes -Wmissing-field-initializers  -g -O2 -MT lib/aes128.o -MD -MP -MF $depbase.Tpo -c -o lib/aes128.o lib/aes128.c &&\
>> >> mv -f $depbase.Tpo $depbase.Po
>> >> In file included from lib/aes128.c:29:0:
>> >> lib/util.h:290:14: error: conflicting types for 'popcount'
>> >> /usr/include/strings.h:57:14: note: previous declaration of 'popcount' was here
>> >> gmake[2]: *** [lib/aes128.o] Error 1
>> > 
>> > Oops.  Let's rename OVS's popcount then.  How about count_1bits?
>> 
>> sounds fine to me.  do you want me prepare a patch?
> 
> If you have the time, then that would be very convenient, thank you.

done.



More information about the dev mailing list