This is an automated email from the ASF dual-hosted git repository. alexey pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/kudu.git
The following commit(s) were added to refs/heads/master by this push: new baeb256b3 [util] replace BOOST_BINARY with 0bxxx notation baeb256b3 is described below commit baeb256b3f9f88186eec3a871cd491349a94eaf8 Author: Alexey Serbin <ale...@apache.org> AuthorDate: Fri May 9 19:52:20 2025 -0700 [util] replace BOOST_BINARY with 0bxxx notation Since the codebase has switched to the C++17 standard a long time ago, it's possible to use 0bxxx notation (available in C++14) instead of BOOST_BINARY. This changelist doesn't not contain any functional modifications. Change-Id: Ibb259c66ff6d2497e23bccfe6e3e75d996d32c6b Reviewed-on: http://gerrit.cloudera.org:8080/22875 Tested-by: Marton Greber <greber...@gmail.com> Reviewed-by: Marton Greber <greber...@gmail.com> --- src/kudu/tablet/concurrent_btree.h | 15 ++++++--------- src/kudu/util/bit-util-test.cc | 32 ++++++++------------------------ src/kudu/util/group_varint-inl.h | 29 +++++------------------------ src/kudu/util/group_varint-test.cc | 17 +---------------- src/kudu/util/group_varint.cc | 9 ++++----- src/kudu/util/rle-test.cc | 25 +++++-------------------- 6 files changed, 29 insertions(+), 98 deletions(-) diff --git a/src/kudu/tablet/concurrent_btree.h b/src/kudu/tablet/concurrent_btree.h index ede4478e5..b60abc3e6 100644 --- a/src/kudu/tablet/concurrent_btree.h +++ b/src/kudu/tablet/concurrent_btree.h @@ -44,7 +44,6 @@ #include <algorithm> #include <atomic> #include <boost/smart_ptr/detail/yield_k.hpp> -#include <boost/utility/binary.hpp> #include <memory> #include <string> @@ -242,13 +241,12 @@ struct VersionField { BTREE_VINSERT_SHIFT = 27, BTREE_VSPLIT_SHIFT = 0, -#define BB(x) BOOST_BINARY(x) BTREE_LOCK_MASK = - BB(10000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 ), + 0b10000000'00000000'00000000'00000000'00000000'00000000'00000000'00000000, BTREE_SPLITTING_MASK = - BB(01000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 ), + 0b01000000'00000000'00000000'00000000'00000000'00000000'00000000'00000000, BTREE_INSERTING_MASK = - BB(00100000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 ), + 0b00100000'00000000'00000000'00000000'00000000'00000000'00000000'00000000, // There is one unused byte between the single-bit fields and the // incremented fields. This allows us to efficiently increment the @@ -257,12 +255,11 @@ struct VersionField { // not a problem, since the vsplit change always results in a retry. // If we roll over into this unused bit, we'll mask it out. BTREE_UNUSED_MASK = - BB(00010000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 ), + 0b00010000'00000000'00000000'00000000'00000000'00000000'00000000'00000000, BTREE_VINSERT_MASK = - BB(00001111 11111111 11111111 11111111 11111100 00000000 00000000 00000000 ), + 0b00001111'11111111'11111111'11111111'11111100'00000000'00000000'00000000, BTREE_VSPLIT_MASK = - BB(00000000 00000000 00000000 00000000 00000011 11111111 11111111 11111111 ), -#undef BB + 0b00000000'00000000'00000000'00000000'00000011'11111111'11111111'11111111, }; //Undeclared constructor - this is just static utilities. diff --git a/src/kudu/util/bit-util-test.cc b/src/kudu/util/bit-util-test.cc index 8f8b3df7f..1d89fe980 100644 --- a/src/kudu/util/bit-util-test.cc +++ b/src/kudu/util/bit-util-test.cc @@ -16,45 +16,29 @@ // under the License. #include "kudu/util/bit-util.h" -#include <boost/preprocessor/arithmetic/dec.hpp> -#include <boost/preprocessor/arithmetic/inc.hpp> -#include <boost/preprocessor/control/iif.hpp> -#include <boost/preprocessor/control/while.hpp> -#include <boost/preprocessor/list/fold_left.hpp> -#include <boost/preprocessor/logical/bitand.hpp> -#include <boost/preprocessor/logical/bool.hpp> -#include <boost/preprocessor/logical/compl.hpp> -#include <boost/preprocessor/seq/elem.hpp> -#include <boost/preprocessor/seq/fold_left.hpp> -#include <boost/preprocessor/seq/size.hpp> -#include <boost/preprocessor/tuple/elem.hpp> -#include <boost/preprocessor/variadic/elem.hpp> -#include <boost/tti/has_template.hpp> -#include <boost/utility/binary.hpp> #include <gtest/gtest.h> namespace kudu { TEST(BitUtil, TrailingBits) { - EXPECT_EQ(BitUtil::TrailingBits(BOOST_BINARY(1 1 1 1 1 1 1 1), 0), 0); - EXPECT_EQ(BitUtil::TrailingBits(BOOST_BINARY(1 1 1 1 1 1 1 1), 1), 1); - EXPECT_EQ(BitUtil::TrailingBits(BOOST_BINARY(1 1 1 1 1 1 1 1), 64), - BOOST_BINARY(1 1 1 1 1 1 1 1)); - EXPECT_EQ(BitUtil::TrailingBits(BOOST_BINARY(1 1 1 1 1 1 1 1), 100), - BOOST_BINARY(1 1 1 1 1 1 1 1)); + EXPECT_EQ(BitUtil::TrailingBits(0b11111111, 0), 0); + EXPECT_EQ(BitUtil::TrailingBits(0b11111111, 1), 1); + EXPECT_EQ(BitUtil::TrailingBits(0b11111111, 64), 0b11111111); + EXPECT_EQ(BitUtil::TrailingBits(0b11111111, 100), 0b11111111); EXPECT_EQ(BitUtil::TrailingBits(0, 1), 0); EXPECT_EQ(BitUtil::TrailingBits(0, 64), 0); EXPECT_EQ(BitUtil::TrailingBits(1LL << 63, 0), 0); EXPECT_EQ(BitUtil::TrailingBits(1LL << 63, 63), 0); EXPECT_EQ(BitUtil::TrailingBits(1LL << 63, 64), 1LL << 63); - } TEST(BitUtil, ShiftBits) { EXPECT_EQ(BitUtil::ShiftLeftZeroOnOverflow(1ULL, 64), 0ULL); - EXPECT_EQ(BitUtil::ShiftLeftZeroOnOverflow(0xFFFFFFFFFFFFFFFFULL, 32), 0xFFFFFFFF00000000ULL); + EXPECT_EQ(BitUtil::ShiftLeftZeroOnOverflow(0xFFFFFFFFFFFFFFFFULL, 32), + 0xFFFFFFFF00000000ULL); EXPECT_EQ(BitUtil::ShiftRightZeroOnOverflow(1ULL, 64), 0ULL); - EXPECT_EQ(BitUtil::ShiftRightZeroOnOverflow(0xFFFFFFFFFFFFFFFFULL, 32), 0x00000000FFFFFFFFULL); + EXPECT_EQ(BitUtil::ShiftRightZeroOnOverflow(0xFFFFFFFFFFFFFFFFULL, 32), + 0x00000000FFFFFFFFULL); } } // namespace kudu diff --git a/src/kudu/util/group_varint-inl.h b/src/kudu/util/group_varint-inl.h index 10eae52ae..19933d929 100644 --- a/src/kudu/util/group_varint-inl.h +++ b/src/kudu/util/group_varint-inl.h @@ -14,8 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -#ifndef KUDU_UTIL_GROUP_VARINT_INL_H -#define KUDU_UTIL_GROUP_VARINT_INL_H +#pragma once #ifdef __linux__ #include <endian.h> @@ -33,21 +32,6 @@ #include <cstdint> #include <cstring> -#include <boost/utility/binary.hpp> -#include <boost/parameter/name.hpp> -#include <boost/preprocessor/arithmetic/dec.hpp> -#include <boost/preprocessor/arithmetic/inc.hpp> -#include <boost/preprocessor/control/iif.hpp> -#include <boost/preprocessor/control/while.hpp> -#include <boost/preprocessor/list/fold_left.hpp> -#include <boost/preprocessor/logical/bitand.hpp> -#include <boost/preprocessor/logical/bool.hpp> -#include <boost/preprocessor/logical/compl.hpp> -#include <boost/preprocessor/seq/elem.hpp> -#include <boost/preprocessor/seq/fold_left.hpp> -#include <boost/preprocessor/seq/size.hpp> -#include <boost/preprocessor/tuple/elem.hpp> -#include <boost/preprocessor/variadic/elem.hpp> #include <glog/logging.h> #ifndef __linux__ @@ -81,10 +65,10 @@ inline const uint8_t *DecodeGroupVarInt32( const uint8_t *src, uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d) { - uint8_t a_sel = (*src & BOOST_BINARY(11 00 00 00)) >> 6; - uint8_t b_sel = (*src & BOOST_BINARY(00 11 00 00)) >> 4; - uint8_t c_sel = (*src & BOOST_BINARY(00 00 11 00)) >> 2; - uint8_t d_sel = (*src & BOOST_BINARY(00 00 00 11 )); + uint8_t a_sel = (*src & 0b11000000) >> 6; + uint8_t b_sel = (*src & 0b00110000) >> 4; + uint8_t c_sel = (*src & 0b00001100) >> 2; + uint8_t d_sel = (*src & 0b00000011); src++; // skip past selector byte @@ -294,8 +278,5 @@ inline void AppendGroupVarInt32Sequence(faststring *s, uint32_t frame_of_referen } } - } // namespace coding } // namespace kudu - -#endif diff --git a/src/kudu/util/group_varint-test.cc b/src/kudu/util/group_varint-test.cc index ac15ef116..56259e27d 100644 --- a/src/kudu/util/group_varint-test.cc +++ b/src/kudu/util/group_varint-test.cc @@ -25,21 +25,6 @@ #include "kudu/util/group_varint-inl.h" -#include <boost/preprocessor/arithmetic/dec.hpp> -#include <boost/preprocessor/arithmetic/inc.hpp> -#include <boost/preprocessor/control/iif.hpp> -#include <boost/preprocessor/control/while.hpp> -#include <boost/preprocessor/list/fold_left.hpp> -#include <boost/preprocessor/logical/bitand.hpp> -#include <boost/preprocessor/logical/bool.hpp> -#include <boost/preprocessor/logical/compl.hpp> -#include <boost/preprocessor/seq/elem.hpp> -#include <boost/preprocessor/seq/fold_left.hpp> -#include <boost/preprocessor/seq/size.hpp> -#include <boost/preprocessor/tuple/elem.hpp> -#include <boost/preprocessor/variadic/elem.hpp> -#include <boost/tti/has_template.hpp> -#include <boost/utility/binary.hpp> #include <gtest/gtest.h> #include "kudu/util/faststring.h" @@ -117,7 +102,7 @@ TEST(TestGroupVarInt, TestGroupVarInt) { // Mixed 1-byte and 2-byte AppendGroupVarInt32(&buf, 256, 2, 3, 65535); ASSERT_EQ(7UL, buf.size()); - ASSERT_EQ(BOOST_BINARY(01 00 00 01), buf.at(0)); + ASSERT_EQ(0b01000001, buf.at(0)); ASSERT_EQ(256, *reinterpret_cast<const uint16_t *>(&buf[1])); ASSERT_EQ(2, *reinterpret_cast<const uint8_t *>(&buf[3])); ASSERT_EQ(3, *reinterpret_cast<const uint8_t *>(&buf[4])); diff --git a/src/kudu/util/group_varint.cc b/src/kudu/util/group_varint.cc index 8aeaea48c..01d2dc26f 100644 --- a/src/kudu/util/group_varint.cc +++ b/src/kudu/util/group_varint.cc @@ -21,7 +21,6 @@ #include <cstring> #include <ostream> -#include <boost/utility/binary.hpp> #include <glog/logging.h> #include "kudu/util/hexdump.h" @@ -42,10 +41,10 @@ static void InitializeSSETables() { uint32_t *entry = reinterpret_cast<uint32_t *>(&SSE_TABLE[i * 16]); uint8_t selectors[] = { - static_cast<uint8_t>((i & BOOST_BINARY(11 00 00 00)) >> 6), - static_cast<uint8_t>((i & BOOST_BINARY(00 11 00 00)) >> 4), - static_cast<uint8_t>((i & BOOST_BINARY(00 00 11 00)) >> 2), - static_cast<uint8_t>((i & BOOST_BINARY(00 00 00 11))) }; + static_cast<uint8_t>((i & 0b11000000) >> 6), + static_cast<uint8_t>((i & 0b00110000) >> 4), + static_cast<uint8_t>((i & 0b00001100) >> 2), + static_cast<uint8_t>((i & 0b00000011)) }; // 00000000 -> // 00 ff ff ff 01 ff ff ff 02 ff ff ff 03 ff ff ff diff --git a/src/kudu/util/rle-test.cc b/src/kudu/util/rle-test.cc index c85553c08..b08ebcc68 100644 --- a/src/kudu/util/rle-test.cc +++ b/src/kudu/util/rle-test.cc @@ -24,21 +24,6 @@ #include <string> #include <vector> -#include <boost/preprocessor/arithmetic/dec.hpp> -#include <boost/preprocessor/arithmetic/inc.hpp> -#include <boost/preprocessor/control/iif.hpp> -#include <boost/preprocessor/control/while.hpp> -#include <boost/preprocessor/list/fold_left.hpp> -#include <boost/preprocessor/logical/bitand.hpp> -#include <boost/preprocessor/logical/bool.hpp> -#include <boost/preprocessor/logical/compl.hpp> -#include <boost/preprocessor/seq/elem.hpp> -#include <boost/preprocessor/seq/fold_left.hpp> -#include <boost/preprocessor/seq/size.hpp> -#include <boost/preprocessor/tuple/elem.hpp> -#include <boost/preprocessor/variadic/elem.hpp> -#include <boost/tti/has_template.hpp> -#include <boost/utility/binary.hpp> #include <glog/logging.h> #include <gtest/gtest.h> @@ -72,7 +57,7 @@ TEST(BitArray, TestBool) { writer.PutValue(i % 2, 1); } writer.Flush(); - EXPECT_EQ(buffer[0], BOOST_BINARY(1 0 1 0 1 0 1 0)); + EXPECT_EQ(buffer[0], 0b10101010); // Write 00110011 for (int i = 0; i < 8; ++i) { @@ -91,8 +76,8 @@ TEST(BitArray, TestBool) { writer.Flush(); // Validate the exact bit value - EXPECT_EQ(buffer[0], BOOST_BINARY(1 0 1 0 1 0 1 0)); - EXPECT_EQ(buffer[1], BOOST_BINARY(1 1 0 0 1 1 0 0)); + EXPECT_EQ(buffer[0], 0b10101010); + EXPECT_EQ(buffer[1], 0b11001100); // Use the reader and validate BitReader reader(buffer.data(), buffer.size()); @@ -257,10 +242,10 @@ TEST(Rle, SpecificSequences) { int num_groups = BitUtil::Ceil<3>(100); expected_buffer[0] = (num_groups << 1) | 1; for (int i = 0; i < 100/8; ++i) { - expected_buffer[i + 1] = BOOST_BINARY(1 0 1 0 1 0 1 0); // 0xaa + expected_buffer[i + 1] = 0b10101010; // 0xaa } // Values for the last 4 0 and 1's - expected_buffer[1 + 100/8] = BOOST_BINARY(0 0 0 0 1 0 1 0); // 0x0a + expected_buffer[1 + 100/8] = 0b00001010; // 0x0a // num_groups and expected_buffer only valid for bit width = 1 ValidateRle(values, 1, expected_buffer, 1 + num_groups);