summaryrefslogtreecommitdiffstats
path: root/src/include/math.h
diff options
context:
space:
mode:
authorPatrick Williams <iawillia@us.ibm.com>2011-03-05 10:01:45 -0600
committerPatrick Williams <iawillia@us.ibm.com>2011-03-05 10:01:45 -0600
commit706243ac48cf646d503a3f1ec9e6a28c916694bd (patch)
tree5d583486a145a9646eccb9d3c4bce4dad45a2a84 /src/include/math.h
parent5c20d316d21e231daee6455f0a78d5940d59cf23 (diff)
downloadblackbird-hostboot-706243ac48cf646d503a3f1ec9e6a28c916694bd.tar.gz
blackbird-hostboot-706243ac48cf646d503a3f1ec9e6a28c916694bd.zip
Merge of PowerHAL project up to commit:
dd45c30bd53d8e6c123165b83842d08117558a3c
Diffstat (limited to 'src/include/math.h')
-rw-r--r--src/include/math.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/include/math.h b/src/include/math.h
new file mode 100644
index 000000000..eddb92f64
--- /dev/null
+++ b/src/include/math.h
@@ -0,0 +1,23 @@
+#include <stdint.h>
+#include <builtins.h>
+
+#ifndef _MATH_H
+#define _MATH_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ALWAYS_INLINE
+static inline int64_t log2(uint64_t s)
+{
+ int64_t n = cntlzd(s);
+ return 63-n;
+}
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif
OpenPOWER on IntegriCloud