1
Fork 0

rename sub_ptr 😅

This commit is contained in:
bendn 2025-02-23 20:26:28 +07:00
parent 1805b33483
commit c813d8f3e4
No known key found for this signature in database
GPG key ID: 0D9D3A2A3B2A93D6
18 changed files with 51 additions and 51 deletions

View file

@ -280,13 +280,13 @@ impl<'a> MemDecoder<'a> {
#[inline]
pub fn len(&self) -> usize {
// SAFETY: This recovers the length of the original slice, only using members we never modify.
unsafe { self.end.sub_ptr(self.start) }
unsafe { self.end.offset_from_unsigned(self.start) }
}
#[inline]
pub fn remaining(&self) -> usize {
// SAFETY: This type guarantees current <= end.
unsafe { self.end.sub_ptr(self.current) }
unsafe { self.end.offset_from_unsigned(self.current) }
}
#[cold]
@ -400,7 +400,7 @@ impl<'a> Decoder for MemDecoder<'a> {
#[inline]
fn position(&self) -> usize {
// SAFETY: This type guarantees start <= current
unsafe { self.current.sub_ptr(self.start) }
unsafe { self.current.offset_from_unsigned(self.start) }
}
}