1
0
Fork 0
mirror of https://github.com/azalea-rs/simdnbt.git synced 2025-08-02 07:26:04 +00:00

inline some functions

This commit is contained in:
mat 2024-05-13 23:45:52 +00:00
parent 39b68ea725
commit 608cf43886

View file

@ -74,6 +74,7 @@ impl<T> IndividualTagAllocator<T>
where where
T: Clone, T: Clone,
{ {
#[inline]
pub fn start(&mut self, depth: usize) -> ContiguousTagsAllocator<T> { pub fn start(&mut self, depth: usize) -> ContiguousTagsAllocator<T> {
// make sure we have enough space for this depth // make sure we have enough space for this depth
// (also note that depth is reused for compounds and arrays so we might have to push // (also note that depth is reused for compounds and arrays so we might have to push
@ -87,6 +88,7 @@ where
start_allocating_tags(alloc) start_allocating_tags(alloc)
} }
#[inline]
pub fn finish<'a>(&mut self, alloc: ContiguousTagsAllocator<T>, depth: usize) -> &'a [T] { pub fn finish<'a>(&mut self, alloc: ContiguousTagsAllocator<T>, depth: usize) -> &'a [T] {
finish_allocating_tags(alloc, &mut self.current[depth], &mut self.previous[depth]) finish_allocating_tags(alloc, &mut self.current[depth], &mut self.previous[depth])
} }
@ -109,6 +111,7 @@ impl<T> Drop for IndividualTagAllocator<T> {
} }
} }
#[inline]
fn start_allocating_tags<T>(alloc: TagsAllocation<T>) -> ContiguousTagsAllocator<T> { fn start_allocating_tags<T>(alloc: TagsAllocation<T>) -> ContiguousTagsAllocator<T> {
let is_new_allocation = alloc.cap == 0; let is_new_allocation = alloc.cap == 0;
ContiguousTagsAllocator { ContiguousTagsAllocator {
@ -117,6 +120,7 @@ fn start_allocating_tags<T>(alloc: TagsAllocation<T>) -> ContiguousTagsAllocator
size: 0, size: 0,
} }
} }
#[inline]
fn finish_allocating_tags<'a, T>( fn finish_allocating_tags<'a, T>(
alloc: ContiguousTagsAllocator<T>, alloc: ContiguousTagsAllocator<T>,
current_alloc: &mut TagsAllocation<T>, current_alloc: &mut TagsAllocation<T>,