diff options
| author | Mark Brown <broonie@linaro.org> | 2013-11-24 14:35:18 +0000 |
|---|---|---|
| committer | Mark Brown <broonie@linaro.org> | 2013-11-24 14:35:18 +0000 |
| commit | 30c27abd28fa168d7ebd2e5286f1fe473c74bfa9 (patch) | |
| tree | 9936b38c0c81cd430d5e75906c1207d127fe588c /include/linux/bitops.h | |
| parent | 16ec790938d4f356c82fab27b9a9adf4d6fe19a6 (diff) | |
| parent | 6ce4eac1f600b34f2f7f58f9cd8f0503d79e42ae (diff) | |
Merge tag 'v3.13-rc1' into asoc-arizona
Linux 3.13-rc1
Diffstat (limited to 'include/linux/bitops.h')
| -rw-r--r-- | include/linux/bitops.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/bitops.h b/include/linux/bitops.h index a3b6b82108b9..abc9ca778456 100644 --- a/include/linux/bitops.h +++ b/include/linux/bitops.h @@ -4,12 +4,23 @@ #ifdef __KERNEL__ #define BIT(nr) (1UL << (nr)) +#define BIT_ULL(nr) (1ULL << (nr)) #define BIT_MASK(nr) (1UL << ((nr) % BITS_PER_LONG)) #define BIT_WORD(nr) ((nr) / BITS_PER_LONG) +#define BIT_ULL_MASK(nr) (1ULL << ((nr) % BITS_PER_LONG_LONG)) +#define BIT_ULL_WORD(nr) ((nr) / BITS_PER_LONG_LONG) #define BITS_PER_BYTE 8 #define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long)) #endif +/* + * Create a contiguous bitmask starting at bit position @l and ending at + * position @h. For example + * GENMASK_ULL(39, 21) gives us the 64bit vector 0x000000ffffe00000. + */ +#define GENMASK(h, l) (((U32_C(1) << ((h) - (l) + 1)) - 1) << (l)) +#define GENMASK_ULL(h, l) (((U64_C(1) << ((h) - (l) + 1)) - 1) << (l)) + extern unsigned int __sw_hweight8(unsigned int w); extern unsigned int __sw_hweight16(unsigned int w); extern unsigned int __sw_hweight32(unsigned int w); |
