1
Fork 0

Small performance tweaks

This commit is contained in:
Deadbeef 2021-12-08 21:08:44 +08:00
parent 17b53b9645
commit 83587e8d30
No known key found for this signature in database
GPG key ID: 6D017A96D8E6C2F9
3 changed files with 9 additions and 9 deletions

View file

@ -94,9 +94,11 @@ where
// SAFETY: pointer_raw returns the original pointer
unsafe { std::mem::transmute_copy(&self.pointer_raw()) }
}
#[inline]
pub fn tag(&self) -> T {
unsafe { T::from_usize(self.packed.get() >> Self::TAG_BIT_SHIFT) }
}
#[inline]
pub fn set_tag(&mut self, tag: T) {
let mut packed = self.packed.get();
let new_tag = T::into_usize(tag) << Self::TAG_BIT_SHIFT;