44 #ifndef __CGN_BITMAP_H__ 45 #define __CGN_BITMAP_H__ 55 #define clib_bitmap_dup(v) vec_dup(v) 56 #define clib_bitmap_free(v) vec_free(v) 57 #define clib_bitmap_bytes(v) vec_bytes(v) 58 #define clib_bitmap_zero(v) vec_zero(v) 61 #define clib_bitmap_alloc(v,n_bits) \ 62 v = vec_new (uword, ((n_bits) + BITS (uword) - 1) / BITS (uword)) 76 return (ai & bit) != 0;
91 return (ai & bit) != 0;
98 unsigned char num_bits)
102 uword result = ai[i0] >> i1;
103 if(num_bits >=
BITS(ai[0]))
return result;
105 result = result & (((
uword)1 << num_bits) - 1);
115 if(num_bits >=
BITS(ai[0])) {
120 if(ai[i0] ^ bitmask)
return 0;
121 num_bits = num_bits -
BITS (ai[0]);
123 }
while (num_bits > 0);
128 bitmask = ((
uword)1 << num_bits) -1;
129 return (!(result ^ bitmask));
sll srl srl sll sra u16x4 i
static uword cgn_clib_bitmap_get_bits(uword *ai, u16 start, unsigned char num_bits)
static uword cgn_clib_bitmap_clear_no_check(uword *a, uword i)
Linear Congruential Random Number Generator.
static uword cgn_clib_bitmap_check_if_all(uword *ai, u16 start, i16 num_bits)
static uword cgn_clib_bitmap_set_no_check(uword *a, uword i)
CLIB vectors are ubiquitous dynamically resized arrays with by user defined "headers".