diff options
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/bitops.h | 8 | ||||
-rw-r--r-- | include/linux/types.h | 3 |
2 files changed, 8 insertions, 3 deletions
diff --git a/include/linux/bitops.h b/include/linux/bitops.h index b9fb8ee3308b..939e80bdbef7 100644 --- a/include/linux/bitops.h +++ b/include/linux/bitops.h | |||
@@ -2,6 +2,14 @@ | |||
2 | #define _LINUX_BITOPS_H | 2 | #define _LINUX_BITOPS_H |
3 | #include <asm/types.h> | 3 | #include <asm/types.h> |
4 | 4 | ||
5 | #ifdef __KERNEL__ | ||
6 | #define BIT_MASK(nr) (1UL << ((nr) % BITS_PER_LONG)) | ||
7 | #define BIT_WORD(nr) ((nr) / BITS_PER_LONG) | ||
8 | #define BITS_TO_TYPE(nr, t) (((nr)+(t)-1)/(t)) | ||
9 | #define BITS_TO_LONGS(nr) BITS_TO_TYPE(nr, BITS_PER_LONG) | ||
10 | #define BITS_PER_BYTE 8 | ||
11 | #endif | ||
12 | |||
5 | /* | 13 | /* |
6 | * Include this here because some architectures need generic_ffs/fls in | 14 | * Include this here because some architectures need generic_ffs/fls in |
7 | * scope | 15 | * scope |
diff --git a/include/linux/types.h b/include/linux/types.h index 0351bf2fac85..4f0dad21c917 100644 --- a/include/linux/types.h +++ b/include/linux/types.h | |||
@@ -3,12 +3,9 @@ | |||
3 | 3 | ||
4 | #ifdef __KERNEL__ | 4 | #ifdef __KERNEL__ |
5 | 5 | ||
6 | #define BITS_TO_LONGS(bits) \ | ||
7 | (((bits)+BITS_PER_LONG-1)/BITS_PER_LONG) | ||
8 | #define DECLARE_BITMAP(name,bits) \ | 6 | #define DECLARE_BITMAP(name,bits) \ |
9 | unsigned long name[BITS_TO_LONGS(bits)] | 7 | unsigned long name[BITS_TO_LONGS(bits)] |
10 | 8 | ||
11 | #define BITS_PER_BYTE 8 | ||
12 | #endif | 9 | #endif |
13 | 10 | ||
14 | #include <linux/posix_types.h> | 11 | #include <linux/posix_types.h> |