Skip to content

Commit

Permalink
Skip bounds check for inline slices (#277)
Browse files Browse the repository at this point in the history
  • Loading branch information
overlookmotel authored Jul 17, 2024
1 parent a7793f0 commit 1b636e9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/atom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,9 @@ impl<Static: StaticAtomSet> ops::Deref for Atom<Static> {
}
INLINE_TAG => {
let len = (self.unsafe_data() & LEN_MASK) >> LEN_OFFSET;
debug_assert!(len as usize <= MAX_INLINE_LEN);
let src = inline_atom_slice(&self.unsafe_data);
str::from_utf8_unchecked(&src[..(len as usize)])
str::from_utf8_unchecked(src.get_unchecked(..(len as usize)))
}
STATIC_TAG => Static::get().atoms[self.static_index() as usize],
_ => debug_unreachable!(),
Expand Down

0 comments on commit 1b636e9

Please sign in to comment.