diff options
Diffstat (limited to 'include/linux/bitops.h')
| -rw-r--r-- | include/linux/bitops.h | 10 | 
1 files changed, 10 insertions, 0 deletions
diff --git a/include/linux/bitops.h b/include/linux/bitops.h index cb3c3ef50f5..38c2fb7ebe0 100644 --- a/include/linux/bitops.h +++ b/include/linux/bitops.h @@ -84,6 +84,16 @@ static __inline__ int get_bitmask_order(unsigned int count)  	return order;	/* We could be slightly more clever with -1 here... */  } +static __inline__ int get_count_order(unsigned int count) +{ +	int order; +	 +	order = fls(count) - 1; +	if (count & (count - 1)) +		order++; +	return order; +} +  /*   * hweightN: returns the hamming weight (i.e. the number   * of bits set) of a N-bit word  |