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.

> +    }
> +}
> +

  Jarno

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to