datapath: Rename linux-2.6 and compat-2.6 directories.
[sliver-openvswitch.git] / datapath / linux / compat / include / linux / log2.h
diff --git a/datapath/linux/compat/include/linux/log2.h b/datapath/linux/compat/include/linux/log2.h
new file mode 100644 (file)
index 0000000..69abae5
--- /dev/null
@@ -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