diff --git a/src/radix.h b/src/radix.h --- a/src/radix.h +++ b/src/radix.h @@ -394,21 +394,21 @@ /** * Facility for using an uint256 as a radix tree key. */ -struct Uint256KeyWrapper { +struct Uint256RadixKey { arith_uint256 base; - Uint256KeyWrapper(const uint256 &keyIn) : base(UintToArith256(keyIn)) {} - Uint256KeyWrapper(const base_uint<256> &keyIn) : base(keyIn) {} + Uint256RadixKey(const uint256 &keyIn) : base(UintToArith256(keyIn)) {} + Uint256RadixKey(const base_uint<256> &keyIn) : base(keyIn) {} - Uint256KeyWrapper operator>>(uint32_t shift) const { return base >> shift; } - Uint256KeyWrapper operator&(const Uint256KeyWrapper &mask) const { + Uint256RadixKey operator>>(uint32_t shift) const { return base >> shift; } + Uint256RadixKey operator&(const Uint256RadixKey &mask) const { return base & mask.base; } operator size_t() const { return size_t(base.GetLow64()); } }; // The radix tree relies on sizeof to gather the bit length of the key -static_assert(sizeof(Uint256KeyWrapper) == 32, - "Uint256KeyWrapper key size should be 256 bits"); +static_assert(sizeof(Uint256RadixKey) == 32, + "Uint256RadixKey key size should be 256 bits"); #endif // BITCOIN_RADIX_H diff --git a/src/test/radix_tests.cpp b/src/test/radix_tests.cpp --- a/src/test/radix_tests.cpp +++ b/src/test/radix_tests.cpp @@ -45,11 +45,11 @@ } }; -struct TestElementUint256 : TestElement { +struct TestElementUint256 : TestElement { TestElementUint256(const uint256 &keyIn) - : TestElement(Uint256KeyWrapper(keyIn)) {} + : TestElement(Uint256RadixKey(keyIn)) {} TestElementUint256(uint64_t keyIn) - : TestElement(Uint256KeyWrapper(keyIn)) {} + : TestElement(Uint256RadixKey(keyIn)) {} static inline arith_uint256 signedMin = arith_uint256(1) << 255; static inline arith_uint256 signedMax = ~signedMin; @@ -530,20 +530,19 @@ } BOOST_AUTO_TEST_CASE(uint256_key_wrapper) { - Uint256KeyWrapper key = uint256S( + Uint256RadixKey key = uint256S( "AA00000000000000000000000000000000000000000000000000000000000000"); - auto checkEqual = [&](const Uint256KeyWrapper &val, - const uint256 &expected) { + auto checkEqual = [&](const Uint256RadixKey &val, const uint256 &expected) { BOOST_CHECK_EQUAL(ArithToUint256(val.base), expected); }; - auto checkOperands = [&](const Uint256KeyWrapper &val, + auto checkOperands = [&](const Uint256RadixKey &val, const uint256 &expected_uint256, const size_t expected_size_t) { checkEqual(val, expected_uint256); - checkEqual(val & Uint256KeyWrapper(uint256::ZERO), uint256::ZERO); + checkEqual(val & Uint256RadixKey(uint256::ZERO), uint256::ZERO); checkEqual(val & val, expected_uint256); checkEqual(val & TestElementUint256::MinusOne(), expected_uint256);