From ad7be994ce4288393ee5096d1db7dfaf8aee8442 Mon Sep 17 00:00:00 2001 From: Brendan Hansknecht Date: Tue, 17 Sep 2024 13:33:33 -0700 Subject: [PATCH] minor cleanup --- crates/roc_std_heap/src/lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/roc_std_heap/src/lib.rs b/crates/roc_std_heap/src/lib.rs index a77d46b41c..9a9dc152cf 100644 --- a/crates/roc_std_heap/src/lib.rs +++ b/crates/roc_std_heap/src/lib.rs @@ -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 RefcountedResourceHeap { let offset = i * Heap::>::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 }; } } }