diff options
author | Masahiro Yamada <yamada.masahiro@socionext.com> | 2017-11-21 20:38:11 +0300 |
---|---|---|
committer | Masahiro Yamada <yamada.masahiro@socionext.com> | 2017-11-28 18:28:57 +0300 |
commit | ed3986ca30972c94f0076f88c948406ce030a05c (patch) | |
tree | a05abe7380bca8e5b3fa77c74e55c5de1b011bae /include/linux | |
parent | ab5502bf561b2cf250cec9d864585be54e9067b7 (diff) | |
download | u-boot-ed3986ca30972c94f0076f88c948406ce030a05c.tar.xz |
bitops: collect BIT macros to include/linux/bitops.h
Same macros are defined in various places. Collect them into
include/linux/bitops.h like Linux.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/bitops.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/bitops.h b/include/linux/bitops.h index 576b15dc53..a47f6d17bb 100644 --- a/include/linux/bitops.h +++ b/include/linux/bitops.h @@ -5,9 +5,16 @@ #include <asm-generic/bitsperlong.h> #include <linux/compiler.h> +#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 |