57,7 → 57,7 |
(bit) < (size); \ |
(bit) = find_next_zero_bit((addr), (size), (bit) + 1)) |
|
static __inline__ int get_bitmask_order(unsigned int count) |
static inline int get_bitmask_order(unsigned int count) |
{ |
int order; |
|
65,7 → 65,7 |
return order; /* We could be slightly more clever with -1 here... */ |
} |
|
static __inline__ int get_count_order(unsigned int count) |
static inline int get_count_order(unsigned int count) |
{ |
int order; |
|
75,7 → 75,7 |
return order; |
} |
|
static inline unsigned long hweight_long(unsigned long w) |
static __always_inline unsigned long hweight_long(unsigned long w) |
{ |
return sizeof(w) == 4 ? hweight32(w) : hweight64(w); |
} |
164,6 → 164,8 |
* sign_extend32 - sign extend a 32-bit value using specified bit as sign-bit |
* @value: value to sign extend |
* @index: 0 based bit index (0<=index<32) to sign bit |
* |
* This is safe to use for 16- and 8-bit types as well. |
*/ |
static inline __s32 sign_extend32(__u32 value, int index) |
{ |
171,6 → 173,17 |
return (__s32)(value << shift) >> shift; |
} |
|
/** |
* sign_extend64 - sign extend a 64-bit value using specified bit as sign-bit |
* @value: value to sign extend |
* @index: 0 based bit index (0<=index<64) to sign bit |
*/ |
static inline __s64 sign_extend64(__u64 value, int index) |
{ |
__u8 shift = 63 - index; |
return (__s64)(value << shift) >> shift; |
} |
|
static inline unsigned fls_long(unsigned long l) |
{ |
if (sizeof(l) == 4) |
218,9 → 231,9 |
/** |
* find_last_bit - find the last set bit in a memory region |
* @addr: The address to start the search at |
* @size: The maximum size to search |
* @size: The number of bits to search |
* |
* Returns the bit number of the first set bit, or size. |
* Returns the bit number of the last set bit, or size. |
*/ |
extern unsigned long find_last_bit(const unsigned long *addr, |
unsigned long size); |