Verified Commit 4eef12e5 authored by Alberto Miranda's avatar Alberto Miranda ♨️
Browse files

Rename: chnk_ralign() -> align_right()

parent c431e9f8
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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;
@@ -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;
}


+4 −4
Original line number Diff line number Diff line
@@ -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 ") {

@@ -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);
            }
@@ -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);
            }
@@ -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;