Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions zlib-rs/src/deflate/hash_calc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ impl StandardHashCalc {

let head = state.head.as_slice()[hm];
if head != string as u16 {
state.prev.as_mut_slice()[string & state.w_mask()] = head;
let w_mask = state.w_mask();
state.prev.as_mut_slice()[string & w_mask] = head;
state.head.as_mut_slice()[hm] = string as u16;
}

Expand Down Expand Up @@ -107,7 +108,8 @@ impl RollHashCalc {

let head = state.head.as_slice()[hm];
if head != string as u16 {
state.prev.as_mut_slice()[string & state.w_mask()] = head;
let w_mask = state.w_mask();
state.prev.as_mut_slice()[string & w_mask] = head;
state.head.as_mut_slice()[hm] = string as u16;
}

Expand Down
4 changes: 2 additions & 2 deletions zlib-rs/src/weak_slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ impl<'a, T> WeakSliceMut<'a, T> {
unsafe { core::slice::from_raw_parts(self.ptr, self.len) }
}

pub(crate) fn as_mut_slice(&mut self) -> &'a mut [T] {
pub(crate) fn as_mut_slice(&mut self) -> &mut [T] {
unsafe { core::slice::from_raw_parts_mut(self.ptr, self.len) }
}

Expand Down Expand Up @@ -85,7 +85,7 @@ impl<'a, T, const N: usize> WeakArrayMut<'a, T, N> {
unsafe { core::slice::from_raw_parts(self.ptr.cast(), N) }
}

pub(crate) fn as_mut_slice(&mut self) -> &'a mut [T] {
pub(crate) fn as_mut_slice(&mut self) -> &mut [T] {
unsafe { core::slice::from_raw_parts_mut(self.ptr.cast(), N) }
}

Expand Down
Loading