aboutsummaryrefslogtreecommitdiff
path: root/include/linux/bitops.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/bitops.h')
-rw-r--r--include/linux/bitops.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/linux/bitops.h b/include/linux/bitops.h
index b9fb8ee3308..69c1edb9fe5 100644
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
@@ -2,6 +2,14 @@
#define _LINUX_BITOPS_H
#include <asm/types.h>
+#ifdef __KERNEL__
+#define BIT(nr) (1UL << (nr))
+#define BIT_MASK(nr) (1UL << ((nr) % BITS_PER_LONG))
+#define BIT_WORD(nr) ((nr) / BITS_PER_LONG)
+#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_LONG)
+#define BITS_PER_BYTE 8
+#endif
+
/*
* Include this here because some architectures need generic_ffs/fls in
* scope