aboutsummaryrefslogtreecommitdiff
path: root/sys/compat/linuxkpi/common/include/linux/bits.h
diff options
context:
space:
mode:
Diffstat (limited to 'sys/compat/linuxkpi/common/include/linux/bits.h')
-rw-r--r--sys/compat/linuxkpi/common/include/linux/bits.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/sys/compat/linuxkpi/common/include/linux/bits.h b/sys/compat/linuxkpi/common/include/linux/bits.h
new file mode 100644
index 000000000000..53deb7cbbe88
--- /dev/null
+++ b/sys/compat/linuxkpi/common/include/linux/bits.h
@@ -0,0 +1,14 @@
+/*
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2016 Kip Macy
+ * Copyright (c) 2018 Johannes Lundberg
+ */
+
+#ifndef _LINUXKPI_LINUX_BITS_H_
+#define _LINUXKPI_LINUX_BITS_H_
+
+#define GENMASK(h, l) (((~0UL) >> (BITS_PER_LONG - (h) - 1)) & ((~0UL) << (l)))
+#define GENMASK_ULL(h, l) (((~0ULL) >> (BITS_PER_LONG_LONG - (h) - 1)) & ((~0ULL) << (l)))
+
+#endif /* _LINUXKPI_LINUX_BITS_H_ */