On Wed, Sep 24, 2014 at 11:36:57AM -0700, Jarno Rajahalme wrote: > Correcting myself: > > On Sep 24, 2014, at 11:24 AM, Jarno Rajahalme <jrajaha...@nicira.com> wrote: > > -unsigned long *bitmap_allocate1(size_t n_bits); > > +/* Initializes bitmap to all-1-bits and returns the bitmap pointer. */ > > +static inline void > > +bitmap_init1(unsigned long *bitmap, size_t n_bits) > > +{ > > + size_t n_longs = bitmap_n_longs(n_bits); > > + size_t n_bytes = bitmap_n_bytes(n_bits); > > + size_t r_bits = n_bits % BITMAP_ULONG_BITS; > > + > > + memset(bitmap, 0xff, n_bytes); > > + if (r_bits) { > > + bitmap[n_longs - 1] >>= 64 - r_bits; > > Should have used BITMAP_ULONG_BITS here, this would not work on a > 32-bit build where unsigned long is 32 bits.
Or you could use the technique previously in bitmap_allocate1() that didn't need to know the number of bits in the word. _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev