Skip to content

Commit

Permalink
simplify offset calc, doesn't need a special case for the last slice
Browse files Browse the repository at this point in the history
  • Loading branch information
Moritz Borcherding committed Nov 21, 2024
1 parent b667424 commit 32dd18e
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/encoding/match_generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,8 @@ impl<'data> MatchGenerator<'data> {

if match_len >= MIN_MATCH_LEN {
let literals = &last_entry.data[self.last_idx_in_sequence..self.suffix_idx];
let offset = if is_last {
self.suffix_idx - match_index
} else {
match_entry.base_offset - match_index + self.suffix_idx
};
let offset = match_entry.base_offset + self.suffix_idx - match_index;


#[cfg(debug_assertions)]
{
Expand Down

0 comments on commit 32dd18e

Please sign in to comment.