mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-10 22:18:54 +01:00
refactor: replace sizeof(a)/sizeof(a[0]) by std::size (C++17)
Removes the macro ARRAYLEN and also substitutes all other uses of the same "sizeof(a)/sizeof(a[0])" pattern by std::size, available since C++17.
This commit is contained in:
@@ -107,14 +107,14 @@ BOOST_AUTO_TEST_CASE(siphash)
|
||||
|
||||
// Check test vectors from spec, one byte at a time
|
||||
CSipHasher hasher2(0x0706050403020100ULL, 0x0F0E0D0C0B0A0908ULL);
|
||||
for (uint8_t x=0; x<ARRAYLEN(siphash_4_2_testvec); ++x)
|
||||
for (uint8_t x=0; x<std::size(siphash_4_2_testvec); ++x)
|
||||
{
|
||||
BOOST_CHECK_EQUAL(hasher2.Finalize(), siphash_4_2_testvec[x]);
|
||||
hasher2.Write(&x, 1);
|
||||
}
|
||||
// Check test vectors from spec, eight bytes at a time
|
||||
CSipHasher hasher3(0x0706050403020100ULL, 0x0F0E0D0C0B0A0908ULL);
|
||||
for (uint8_t x=0; x<ARRAYLEN(siphash_4_2_testvec); x+=8)
|
||||
for (uint8_t x=0; x<std::size(siphash_4_2_testvec); x+=8)
|
||||
{
|
||||
BOOST_CHECK_EQUAL(hasher3.Finalize(), siphash_4_2_testvec[x]);
|
||||
hasher3.Write(uint64_t(x)|(uint64_t(x+1)<<8)|(uint64_t(x+2)<<16)|(uint64_t(x+3)<<24)|
|
||||
|
||||
Reference in New Issue
Block a user