From c7aeb9802609c53bd4a95b9ab02a06a4b19dc6e4 Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Thu, 20 Feb 2025 15:53:05 -0500 Subject: [PATCH] use get_unchecked_mut for hotspot --- src/future_moves.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/future_moves.rs b/src/future_moves.rs index d478919..eda815b 100644 --- a/src/future_moves.rs +++ b/src/future_moves.rs @@ -253,7 +253,7 @@ impl FutureMoves { // TODO! impl dynamic sorting based on children's states, maybe it propegates // upwards using the `parent` field // SAFETY! the sort_by_key function should not modify anything - unsafe { &mut *(self as *mut Self) }.arena[idx] + unsafe { (&mut *(self as *mut Self)).arena.get_unchecked_mut(idx) } .children // negative because we want the largest value in the first index .sort_by_key(|&x| -self.arena[x].value);