Loading include/global/arithmetic/arithmetic.hpp +2 −2 Original line number Diff line number Diff line Loading @@ -87,7 +87,7 @@ align_left(const uint64_t offset, const size_t block_size) { * @returns an offset aligned to the right-side block boundary. */ constexpr uint64_t chnk_ralign(const uint64_t offset, const size_t block_size) { align_right(const uint64_t offset, const size_t block_size) { // This check is automatically removed in release builds assert(is_power_of_2(block_size)); return align_left(offset, block_size) + block_size; Loading Loading @@ -128,7 +128,7 @@ constexpr size_t chnk_rpad(const uint64_t offset, const size_t block_size) { // This check is automatically removed in release builds assert(is_power_of_2(block_size)); return chnk_ralign(offset, block_size) - offset; return align_right(offset, block_size) - offset; } Loading tests/unit/test_utils_arithmetic.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -167,7 +167,7 @@ SCENARIO(" offsets can be left-aligned to block size boundaries ", } SCENARIO(" offsets can be right-aligned to block size boundaries ", "[utils][numeric][chnk_ralign]") { "[utils][numeric][align_right]") { GIVEN(" a block size ") { Loading @@ -181,7 +181,7 @@ SCENARIO(" offsets can be right-aligned to block size boundaries ", CAPTURE(offset, block_size); THEN(" the right-aligned offset is block_size ") { const uint64_t aligned_offset = chnk_ralign(offset, block_size); const uint64_t aligned_offset = align_right(offset, block_size); const uint64_t expected_offset = block_size; REQUIRE(aligned_offset == expected_offset); } Loading @@ -195,7 +195,7 @@ SCENARIO(" offsets can be right-aligned to block size boundaries ", CAPTURE(offset, block_size); THEN(" the right-aligned offset is 0 ") { const uint64_t aligned_offset = chnk_ralign(offset, block_size); const uint64_t aligned_offset = align_right(offset, block_size); const uint64_t expected_offset = block_size; REQUIRE(aligned_offset == expected_offset); } Loading @@ -210,7 +210,7 @@ SCENARIO(" offsets can be right-aligned to block size boundaries ", THEN(" the right-aligned offset is the right boundary of the " "containing block ") { const uint64_t aligned_offset = chnk_ralign(offset, block_size); const uint64_t aligned_offset = align_right(offset, block_size); const uint64_t expected_offset = static_cast<uint64_t>(offset / block_size + 1) * block_size; Loading Loading
include/global/arithmetic/arithmetic.hpp +2 −2 Original line number Diff line number Diff line Loading @@ -87,7 +87,7 @@ align_left(const uint64_t offset, const size_t block_size) { * @returns an offset aligned to the right-side block boundary. */ constexpr uint64_t chnk_ralign(const uint64_t offset, const size_t block_size) { align_right(const uint64_t offset, const size_t block_size) { // This check is automatically removed in release builds assert(is_power_of_2(block_size)); return align_left(offset, block_size) + block_size; Loading Loading @@ -128,7 +128,7 @@ constexpr size_t chnk_rpad(const uint64_t offset, const size_t block_size) { // This check is automatically removed in release builds assert(is_power_of_2(block_size)); return chnk_ralign(offset, block_size) - offset; return align_right(offset, block_size) - offset; } Loading
tests/unit/test_utils_arithmetic.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -167,7 +167,7 @@ SCENARIO(" offsets can be left-aligned to block size boundaries ", } SCENARIO(" offsets can be right-aligned to block size boundaries ", "[utils][numeric][chnk_ralign]") { "[utils][numeric][align_right]") { GIVEN(" a block size ") { Loading @@ -181,7 +181,7 @@ SCENARIO(" offsets can be right-aligned to block size boundaries ", CAPTURE(offset, block_size); THEN(" the right-aligned offset is block_size ") { const uint64_t aligned_offset = chnk_ralign(offset, block_size); const uint64_t aligned_offset = align_right(offset, block_size); const uint64_t expected_offset = block_size; REQUIRE(aligned_offset == expected_offset); } Loading @@ -195,7 +195,7 @@ SCENARIO(" offsets can be right-aligned to block size boundaries ", CAPTURE(offset, block_size); THEN(" the right-aligned offset is 0 ") { const uint64_t aligned_offset = chnk_ralign(offset, block_size); const uint64_t aligned_offset = align_right(offset, block_size); const uint64_t expected_offset = block_size; REQUIRE(aligned_offset == expected_offset); } Loading @@ -210,7 +210,7 @@ SCENARIO(" offsets can be right-aligned to block size boundaries ", THEN(" the right-aligned offset is the right boundary of the " "containing block ") { const uint64_t aligned_offset = chnk_ralign(offset, block_size); const uint64_t aligned_offset = align_right(offset, block_size); const uint64_t expected_offset = static_cast<uint64_t>(offset / block_size + 1) * block_size; Loading