Function gkfs::utils::arithmetic::block_count

Function Documentation

constexpr std::size_t gkfs::utils::arithmetic::block_count(const uint64_t offset, const size_t size, const size_t block_size)

Compute the number of blocks involved in an operation affecting the regions from [@offset, to @offset + @count).

Note

This function assumes that @block_size is a power of 2.

Note

This function assumes that @offset + @count does not overflow.

Parameters
  • offset[in] the operation’s initial offset.

  • size[in] the number of bytes affected by the operation.

  • block_size[in] the block size that should be used to compute the number of blocks.

Returns

the number of blocks affected by the operation.