Thanks, applied to master.

On Sat, Jul 26, 2014 at 08:28:10AM -0700, Jarno Rajahalme wrote:
> LGTM,
> 
> Acked-by: Jarno Rajahalme <[email protected]>
> 
> On Jul 25, 2014, at 10:25 PM, Ben Pfaff <[email protected]> wrote:
> 
> > These will be used in an upcoming commit.
> > 
> > Signed-off-by: Ben Pfaff <[email protected]>
> > ---
> > lib/bitmap.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
> > lib/bitmap.h |  6 ++++++
> > 2 files changed, 50 insertions(+)
> > 
> > diff --git a/lib/bitmap.c b/lib/bitmap.c
> > index 4b4e13e..7889aa1 100644
> > --- a/lib/bitmap.c
> > +++ b/lib/bitmap.c
> > @@ -109,3 +109,47 @@ bitmap_count1(const unsigned long int *bitmap, size_t 
> > n)
> > 
> >     return count;
> > }
> > +
> > +/* "dst &= arg;" for n-bit dst and arg.  */
> > +void
> > +bitmap_and(unsigned long *dst, const unsigned long *arg, size_t n)
> > +{
> > +    size_t i;
> > +
> > +    for (i = 0; i < BITMAP_N_LONGS(n); i++) {
> > +        dst[i] &= arg[i];
> > +    }
> > +}
> > +
> > +/* "dst |= arg;" for n-bit dst and arg.  */
> > +void
> > +bitmap_or(unsigned long *dst, const unsigned long *arg, size_t n)
> > +{
> > +    size_t i;
> > +
> > +    for (i = 0; i < BITMAP_N_LONGS(n); i++) {
> > +        dst[i] |= arg[i];
> > +    }
> > +}
> > +
> > +/* "dst = ~dst;" for n-bit dst.  */
> > +void
> > +bitmap_not(unsigned long *dst, size_t n)
> > +{
> > +    size_t i;
> > +
> > +    for (i = 0; i < n / BITMAP_ULONG_BITS; i++) {
> > +        dst[i] = ~dst[i];
> > +    }
> > +    if (n % BITMAP_ULONG_BITS) {
> > +        dst[i] ^= (1u << (n % BITMAP_ULONG_BITS)) - 1;
> > +    }
> > +}
> > +
> > +/* Returns true if all of the 'n' bits in 'bitmap' are 0,
> > + * false if at least one bit is a 1.*/
> > +bool
> > +bitmap_is_all_zeros(const unsigned long *bitmap, size_t n)
> > +{
> > +    return bitmap_scan(bitmap, true, 0, n) == n;
> > +}
> > diff --git a/lib/bitmap.h b/lib/bitmap.h
> > index afe6151..ace091f 100644
> > --- a/lib/bitmap.h
> > +++ b/lib/bitmap.h
> > @@ -104,6 +104,12 @@ size_t bitmap_scan(const unsigned long int *, bool 
> > target,
> >                    size_t start, size_t end);
> > size_t bitmap_count1(const unsigned long *, size_t n);
> > 
> > +void bitmap_and(unsigned long *dst, const unsigned long *arg, size_t n);
> > +void bitmap_or(unsigned long *dst, const unsigned long *arg, size_t n);
> > +void bitmap_not(unsigned long *dst, size_t n);
> > +
> > +bool bitmap_is_all_zeros(const unsigned long *, size_t n);
> > +
> > #define BITMAP_FOR_EACH_1(IDX, SIZE, BITMAP) \
> >     for ((IDX) = bitmap_scan(BITMAP, 1, 0, SIZE); (IDX) < (SIZE);    \
> >          (IDX) = bitmap_scan(BITMAP, 1, (IDX) + 1, SIZE))
> > -- 
> > 1.9.1
> > 
> > _______________________________________________
> > dev mailing list
> > [email protected]
> > http://openvswitch.org/mailman/listinfo/dev
> 
_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev

Reply via email to