use get_unchecked_mut for hotspot

This commit is contained in:
Simon Gardling 2025-02-20 15:53:05 -05:00
parent bcbc232f41
commit c7aeb98026
Signed by: titaniumtown
GPG Key ID: 9AB28AC10ECE533D

View File

@ -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);