Dash Core Source Documentation (0.16.0.1)
Find detailed information regarding the Dash Core source code.
Go to the documentation of this file. 30 static_assert(B < 6u, "B > 6 is not supported.
"); 32 using type = std::uint32_t; 36 struct get_bitmap_type<6u> 38 using type = std::uint64_t; 41 template <bits_t B, typename T=count_t> 42 constexpr T branches = T{1u} << B; 44 template <bits_t B, typename T=size_t> 45 constexpr T mask = branches<B, T> - 1u; 47 template <bits_t B, typename T=count_t> 48 constexpr T max_depth = (sizeof(hash_t) * 8u + B - 1u) / B; 50 template <bits_t B, typename T=count_t> 51 constexpr T max_shift = max_depth<B, count_t> * B; 53 #define IMMER_HAS_BUILTIN_POPCOUNT 1 55 inline auto popcount_fallback(std::uint32_t x) 58 // https://en.wikipedia.org/wiki/Hamming_weight 59 // http://wm.ite.pl/articles/sse-popcount.html 60 // http://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetParallel 61 x = x - ((x >> 1) & 0x55555555u); 62 x = (x & 0x33333333u) + ((x >> 2) & 0x33333333u); 63 return (((x + (x >> 4u)) & 0xF0F0F0Fu) * 0x1010101u) >> 24u; 66 inline auto popcount_fallback(std::uint64_t x) 68 x = x - ((x >> 1) & 0x5555555555555555u); 69 x = (x & 0x3333333333333333u) + ((x >> 2u) & 0x3333333333333333u); 70 return (((x + (x >> 4)) & 0x0F0F0F0F0F0F0F0Fu) * 0x0101010101010101u) >> 56u; 73 inline count_t popcount(std::uint32_t x) 75 #if IMMER_HAS_BUILTIN_POPCOUNT 76 # if defined(_MSC_VER) 79 return __builtin_popcount(x); 82 return popcount_fallback(x); 86 inline count_t popcount(std::uint64_t x) 88 #if IMMER_HAS_BUILTIN_POPCOUNT 89 # if defined(_MSC_VER) 92 return __builtin_popcountll(x); 95 return popcount_fallback(x); 100 } // namespace detail