diff options
author | Yuri Gorshenin <y@maps.me> | 2017-02-08 16:36:03 +0300 |
---|---|---|
committer | Yuri Gorshenin <y@maps.me> | 2017-02-08 16:36:03 +0300 |
commit | acb0e55ebb6a21ad8a570f27d407a05a949fe6d9 (patch) | |
tree | 09c752b38639035869e71f96fba7f30250fdaf05 /base | |
parent | b8bcf82802d73612ab6402516074834d8f85550e (diff) |
CeilLog is renamed to FloorLog.
Diffstat (limited to 'base')
-rw-r--r-- | base/base_tests/bits_test.cpp | 20 | ||||
-rw-r--r-- | base/bits.hpp | 2 | ||||
-rw-r--r-- | base/small_set.hpp | 2 |
3 files changed, 12 insertions, 12 deletions
diff --git a/base/base_tests/bits_test.cpp b/base/base_tests/bits_test.cpp index c2a43733ea..5263246dae 100644 --- a/base/base_tests/bits_test.cpp +++ b/base/base_tests/bits_test.cpp @@ -120,14 +120,14 @@ UNIT_TEST(PopCount64) UNIT_TEST(CeilLog) { - TEST_EQUAL(0, bits::CeilLog(0x0), ()); - TEST_EQUAL(0, bits::CeilLog(0x1), ()); - TEST_EQUAL(1, bits::CeilLog(0x2), ()); - TEST_EQUAL(1, bits::CeilLog(0x3), ()); - TEST_EQUAL(2, bits::CeilLog(0x4), ()); - - TEST_EQUAL(6, bits::CeilLog(0x7f), ()); - TEST_EQUAL(7, bits::CeilLog(0x80), ()); - TEST_EQUAL(31, bits::CeilLog(0xFFFFFFFF), ()); - TEST_EQUAL(63, bits::CeilLog(0xFFFFFFFFFFFFFFFF), ()); + TEST_EQUAL(0, bits::FloorLog(0x0), ()); + TEST_EQUAL(0, bits::FloorLog(0x1), ()); + TEST_EQUAL(1, bits::FloorLog(0x2), ()); + TEST_EQUAL(1, bits::FloorLog(0x3), ()); + TEST_EQUAL(2, bits::FloorLog(0x4), ()); + + TEST_EQUAL(6, bits::FloorLog(0x7f), ()); + TEST_EQUAL(7, bits::FloorLog(0x80), ()); + TEST_EQUAL(31, bits::FloorLog(0xFFFFFFFF), ()); + TEST_EQUAL(63, bits::FloorLog(0xFFFFFFFFFFFFFFFF), ()); } diff --git a/base/bits.hpp b/base/bits.hpp index ad0eeac236..fda447185a 100644 --- a/base/bits.hpp +++ b/base/bits.hpp @@ -70,7 +70,7 @@ namespace bits return static_cast<uint32_t>(x); } - inline uint8_t CeilLog(uint64_t x) noexcept + inline uint8_t FloorLog(uint64_t x) noexcept { #define CHECK_RSH(x, msb, offset) \ if (x >> offset) \ diff --git a/base/small_set.hpp b/base/small_set.hpp index de1dad1406..35c7afe7a1 100644 --- a/base/small_set.hpp +++ b/base/small_set.hpp @@ -54,7 +54,7 @@ public: { ASSERT_NOT_EQUAL(m_current_block, 0, ()); auto const bit = m_current_block & -m_current_block; - return bits::PopCount(bit - 1) + m_current_block_index * 64; + return bits::FloorLog(bit) + m_current_block_index * 64; } Iterator const & operator++() |