mn_nlz.hpp
Go to the documentation of this file.
1 
18 #ifndef MINLIB_STL_NLZ_UTILS_H_
19 #define MINLIB_STL_NLZ_UTILS_H_
20 
21 #include <limits.h>
22 
23 namespace mn {
24  inline size_t nlz_base(uint64_t x) {
25  unsigned long long value = x;
26  return sizeof(value) * CHAR_BIT - __builtin_clzll(value);
27  }
28  inline size_t nlz(uint64_t x) {
29  return nlz_base(x) - 1;
30  }
31 }
32 
33 #endif
Definition: mn_allocator_typetraits.hpp:25
size_t nlz(uint64_t x)
Definition: mn_nlz.hpp:28
size_t nlz_base(uint64_t x)
Definition: mn_nlz.hpp:24