Skip to content

Commit

Permalink
Change the way to init/memset an array.
Browse files Browse the repository at this point in the history
Signed-off-by: Jean-Christophe Dubois <[email protected]>
  • Loading branch information
jcdubois committed Nov 9, 2023
1 parent b57ae1a commit f7670cf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ impl HeatshrinkDecoder {
self.bit_index = 0;
self.state = HSDstate::TagBit;
// memset self.buffer to 0
self.input_buffer.iter_mut().for_each(|m| *m = 0);
self.output_buffer.iter_mut().for_each(|m| *m = 0);
self.input_buffer.fill(0);
self.output_buffer.fill(0);
}

/// Add an input buffer to be processed/uncompressed
Expand Down
4 changes: 2 additions & 2 deletions src/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,11 @@ impl HeatshrinkEncoder {
self.bit_index = 8;
self.state = HSEstate::NotFull;
// memset self.buffer to 0
self.input_buffer.iter_mut().for_each(|m| *m = 0);
self.input_buffer.fill(0);
#[cfg(feature = "heatshrink-use-index")]
{
// memset self.search_index to 0
self.search_index.iter_mut().for_each(|m| *m = None);
self.search_index.fill(None);
}
}

Expand Down

0 comments on commit f7670cf

Please sign in to comment.