Skip to content

Commit

Permalink
Skip bounds check for inline slices
Browse files Browse the repository at this point in the history
  • Loading branch information
overlookmotel committed Jul 4, 2023
1 parent 34f914c commit 35a2fed
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 35a2fed

Please sign in to comment.