9 #define BITS_PER_CHAR 8 
   10 #define BITS_PER_LONG (BITS_PER_CHAR * sizeof(long)) 
   15 static inline unsigned long _flsl(
unsigned long word)
 
   17     return word ? 
sizeof(long) * BITS_PER_CHAR - __builtin_clz(word) : 0;
 
   20 static inline void clear_bit(
unsigned long bit, 
unsigned long *word)
 
   25 static inline void set_bit(
unsigned long bit, 
unsigned long *word)
 
   30 static inline void bitmap_clear_bit(
unsigned long *map, 
unsigned long bit)
 
   32     clear_bit(bit % BITS_PER_LONG, &map[bit / BITS_PER_LONG]);
 
   35 static inline void bitmap_set_bit(
unsigned long *map, 
unsigned long bit)
 
   37     set_bit(bit % BITS_PER_LONG, &map[bit / BITS_PER_LONG]);
 
   40 static inline unsigned long bitmap_get_bit(
unsigned long *map,
 
   43     return map[bit / BITS_PER_LONG] >> (bit % BITS_PER_LONG) & 1;
 
   46 static inline unsigned long find_first_bit(
const unsigned long *addr,
 
   49     for (
unsigned long i = 0; i * BITS_PER_LONG < size; i++) {
 
   51             return MIN(i * BITS_PER_LONG + __builtin_ffsl(addr[i]) - 1, size);
 
   58 static inline unsigned long find_first_zero_bit(
const unsigned long *addr,
 
   61     for (
unsigned long i = 0; i * BITS_PER_LONG < size; i++) {
 
   62         if (addr[i] != ~0ul) {
 
   63             return MIN(i * BITS_PER_LONG + __builtin_ffsl(~addr[i]) - 1, size);