Skip to content

Commit

Permalink
blockreader.rs NFC rename fileoffset blockoffset
Browse files Browse the repository at this point in the history
  • Loading branch information
jtmoon79 committed May 5, 2024
1 parent 6f5862e commit 66bb011
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/readers/blockreader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1496,39 +1496,39 @@ impl BlockReader {
/// Return nearest preceding `BlockOffset` for given `FileOffset`.
#[inline(always)]
pub const fn block_offset_at_file_offset(
file_offset: FileOffset,
fileoffset: FileOffset,
blocksz: BlockSz,
) -> BlockOffset {
(file_offset / blocksz) as BlockOffset
(fileoffset / blocksz) as BlockOffset
}

/// Return nearest preceding `BlockOffset` for given `FileOffset`.
#[inline(always)]
const fn block_offset_at_file_offset_self(
&self,
file_offset: FileOffset,
fileoffset: FileOffset,
) -> BlockOffset {
BlockReader::block_offset_at_file_offset(file_offset, self.blocksz)
BlockReader::block_offset_at_file_offset(fileoffset, self.blocksz)
}

/// See [BlockReader::file_offset_at_block_offset].
///
/// [BlockReader::file_offset_at_block_offset]: crate::readers::blockreader::BlockReader#method.file_offset_at_block_offset
#[inline(always)]
pub const fn file_offset_at_block_offset(
block_offset: BlockOffset,
blockoffset: BlockOffset,
blocksz: BlockSz,
) -> FileOffset {
(block_offset * blocksz) as BlockOffset
(blockoffset * blocksz) as BlockOffset
}

/// Return `FileOffset` (byte offset) at given `BlockOffset`.
#[inline(always)]
pub const fn file_offset_at_block_offset_self(
&self,
block_offset: BlockOffset,
blockoffset: BlockOffset,
) -> FileOffset {
(block_offset * self.blocksz) as BlockOffset
(blockoffset * self.blocksz) as BlockOffset
}

/// Return `FileOffset` (byte offset) at `BlockOffset` + `BlockIndex`.
Expand All @@ -1550,12 +1550,12 @@ impl BlockReader {
/// corresponds to the passed `FileOffset`.
#[inline(always)]
pub const fn block_index_at_file_offset(
file_offset: FileOffset,
fileoffset: FileOffset,
blocksz: BlockSz,
) -> BlockIndex {
(file_offset
(fileoffset
- BlockReader::file_offset_at_block_offset(
BlockReader::block_offset_at_file_offset(file_offset, blocksz),
BlockReader::block_offset_at_file_offset(fileoffset, blocksz),
blocksz,
)) as BlockIndex
}
Expand All @@ -1565,9 +1565,9 @@ impl BlockReader {
#[inline(always)]
pub const fn block_index_at_file_offset_self(
&self,
file_offset: FileOffset,
fileoffset: FileOffset,
) -> BlockIndex {
BlockReader::block_index_at_file_offset(file_offset, self.blocksz)
BlockReader::block_index_at_file_offset(fileoffset, self.blocksz)
}

/// Return `Count` of [`Block`s] in a file.
Expand Down

0 comments on commit 66bb011

Please sign in to comment.