Skip to content

Commit

Permalink
[NFC] Rename for clarity and consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
BuildKite committed Jan 4, 2025
1 parent 57687ba commit efaa747
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion rs/compression/src/compression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pub trait IntSeqDecoder {

/// Creates an iterator that iterates the encoded data and decodes one element at a time on the
/// fly
fn get_iterator<'a>(&self, encoded_data: &'a [u8]) -> Self::IteratorType<'a>;
fn get_iterator<'a>(&self, byte_slice: &'a [u8]) -> Self::IteratorType<'a>;

/// Returns the number of elements in the sequence
fn num_elem(&self) -> usize;
Expand Down
12 changes: 6 additions & 6 deletions rs/compression/src/noc/noc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,17 @@ impl IntSeqDecoder for PlainDecoder {
type IteratorType<'a> = PlainDecodingIterator<'a>;
type Item = u64;

fn new_decoder(encoded_data: &[u8]) -> Self {
fn new_decoder(byte_slice: &[u8]) -> Self {
Self {
size: encoded_data.len(),
size: byte_slice.len(),
}
}

fn get_iterator<'a>(&self, encoded_data: &'a [u8]) -> PlainDecodingIterator<'a> {
fn get_iterator<'a>(&self, byte_slice: &'a [u8]) -> Self::IteratorType {
PlainDecodingIterator {
num_elem: self.num_elem(),
cur_index: 0,
encoded_data_ptr: utils::mem::transmute_u8_to_slice(encoded_data),
encoded_data: utils::mem::transmute_u8_to_slice(byte_slice),
}
}

Expand All @@ -89,7 +89,7 @@ impl IntSeqDecoder for PlainDecoder {
pub struct PlainDecodingIterator<'a> {
num_elem: usize,
cur_index: usize,
encoded_data_ptr: &'a [u64],
encoded_data: &'a [u64],
}

impl<'a> Iterator for PlainDecodingIterator<'a> {
Expand All @@ -98,7 +98,7 @@ impl<'a> Iterator for PlainDecodingIterator<'a> {
fn next(&mut self) -> Option<Self::Item> {
if self.cur_index < self.num_elem {
self.cur_index += 1;
Some(self.encoded_data_ptr[self.cur_index - 1])
Some(self.encoded_data[self.cur_index - 1])
} else {
None
}
Expand Down

0 comments on commit efaa747

Please sign in to comment.