aboutsummaryrefslogtreecommitdiff
path: root/experimental/lfpAlloc/Utils.hpp
diff options
context:
space:
mode:
authorJeff McGlynn <jwmcglynn@google.com>2017-11-16 17:40:22 -0800
committerJeff McGlynn <jwmcglynn@google.com>2017-11-16 17:40:22 -0800
commitd16a940067fbc191364fc1d3e2a2d907209c9320 (patch)
treef41c4b7a0660ee902ec007954d705c5659117219 /experimental/lfpAlloc/Utils.hpp
parent2de00aa4ef5314cb202427175e85f1a9f9f8bd89 (diff)
parentb434c2497fcb52aa1497b84aa8aeb12bb590492d (diff)
downloadtinyobjloader-d16a940067fbc191364fc1d3e2a2d907209c9320.tar.gz
Diffstat (limited to 'experimental/lfpAlloc/Utils.hpp')
-rw-r--r--experimental/lfpAlloc/Utils.hpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/experimental/lfpAlloc/Utils.hpp b/experimental/lfpAlloc/Utils.hpp
new file mode 100644
index 0000000..8740a79
--- /dev/null
+++ b/experimental/lfpAlloc/Utils.hpp
@@ -0,0 +1,20 @@
+#include <cstdint>
+
+namespace lfpAlloc {
+namespace detail {
+template <std::size_t Val, std::size_t base = 2>
+struct Log {
+ enum { value = 1 + Log<Val / base, base>::value };
+};
+
+template <std::size_t base>
+struct Log<1, base> {
+ enum { value = 0 };
+};
+
+template <std::size_t base>
+struct Log<0, base> {
+ enum { value = 0 };
+};
+}
+}