Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ip_set_bitmap.h
Go to the documentation of this file.
1 #ifndef __IP_SET_BITMAP_H
2 #define __IP_SET_BITMAP_H
3 
5 
6 #define IPSET_BITMAP_MAX_RANGE 0x0000FFFF
7 
8 /* Common functions */
9 
10 static inline u32
11 range_to_mask(u32 from, u32 to, u8 *bits)
12 {
13  u32 mask = 0xFFFFFFFE;
14 
15  *bits = 32;
16  while (--(*bits) > 0 && mask && (to & mask) != from)
17  mask <<= 1;
18 
19  return mask;
20 }
21 
22 #endif /* __IP_SET_BITMAP_H */