summaryrefslogtreecommitdiff
path: root/datapath/linux-2.6/compat-2.6/include/linux/log2.h
diff options
context:
space:
mode:
Diffstat (limited to 'datapath/linux-2.6/compat-2.6/include/linux/log2.h')
-rw-r--r--datapath/linux-2.6/compat-2.6/include/linux/log2.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/datapath/linux-2.6/compat-2.6/include/linux/log2.h b/datapath/linux-2.6/compat-2.6/include/linux/log2.h
new file mode 100644
index 000000000..69abae5e8
--- /dev/null
+++ b/datapath/linux-2.6/compat-2.6/include/linux/log2.h
@@ -0,0 +1,17 @@
+#ifndef __LINUX_LOG2_WRAPPER
+#define __LINUX_LOG2_WRAPPER
+
+#ifdef HAVE_LOG2_H
+#include_next <linux/log2.h>
+#else
+/* This is very stripped down because log2.h has far too many dependencies. */
+
+extern __attribute__((const, noreturn))
+int ____ilog2_NaN(void);
+
+#define ilog2(n) ((n) == 4 ? 2 : \
+ (n) == 8 ? 3 : \
+ ____ilog2_NaN())
+#endif
+
+#endif