On Fri, Dec 06, 2013 at 10:39:21AM +0800, Alexander Wu wrote: > On 06/12/2013 01:47, Ben Pfaff wrote: > >On Wed, Dec 04, 2013 at 05:38:29PM +0800, Alexander Wu wrote: > >>V4: > >> Add bitmap_count1 function to count all 1 bits. > > > >I suggest using the count_1bits() function to speed this up. > > > >Thanks, > > > >Ben. > > > > > > Hi Ben, > > Thanks for your suggestion! I'll update the function with more > efficiently algorithm. But I found a problem. > > | type | length > ---------------------------------------------- > bitmap_* | unsigned long * | L32 > count1_bits | uint64_t | 64 > > * L means Least > > Do you have suggestion about how to use count1_bits with unsigned > long safely?
All targets I know about have "unsigned long" of 64 bits or less. If you want to be careful, add a build assertion: BUILD_ASSERT(ULONG_MAX <= UINT64_MAX); _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev