minor cleanup

This commit is contained in:
Brendan Hansknecht 2024-09-17 13:33:33 -07:00
parent 8305affe25
commit ad7be994ce
No known key found for this signature in database
GPG key ID: 0EA784685083E75B

View file

@ -20,6 +20,7 @@ use std::{
};
const REFCOUNT_ONE: usize = isize::MIN as usize;
const REFCOUNT_CONSTANT: usize = 0;
/// ThreadSafeRefcountedResourceHeap is a threadsafe version of the refcounted heap that can avoid a wrapping Mutex and RefCell.
/// This is very important for dealloc performance.
@ -130,7 +131,7 @@ impl<T> RefcountedResourceHeap<T> {
let offset = i * Heap::<Refcounted<T>>::node_size();
let elem_ptr = unsafe { self.0.data.as_mut_ptr().add(offset) };
let rc_ptr = elem_ptr as *mut usize;
unsafe { *rc_ptr = 0 };
unsafe { *rc_ptr = REFCOUNT_CONSTANT };
}
}
}