Skip to content

Commit

Permalink
use the byte_offset API
Browse files Browse the repository at this point in the history
  • Loading branch information
Congyuwang committed Dec 29, 2023
1 parent 0494c67 commit 50b1aab
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,12 +241,12 @@ impl<T> ListHead<T> {

#[inline(always)]
unsafe fn inner(&self) -> &Inner<T> {
&*((self as *const Self as *const char).offset(Self::offset()) as *const Inner<T>)
&*((self as *const Self).byte_offset(Self::offset()) as *const Inner<T>)
}

#[inline(always)]
unsafe fn inner_mut(&mut self) -> &mut Inner<T> {
&mut *((self as *mut Self as *mut char).offset(Self::offset()) as *mut Inner<T>)
&mut *((self as *mut Self).byte_offset(Self::offset()) as *mut Inner<T>)
}

#[inline(always)]
Expand Down

0 comments on commit 50b1aab

Please sign in to comment.