aboutsummaryrefslogtreecommitdiff
path: root/base/runtime
diff options
context:
space:
mode:
authorgingerBill <gingerBill@users.noreply.github.com>2026-02-03 12:19:20 +0000
committergingerBill <gingerBill@users.noreply.github.com>2026-02-03 12:19:20 +0000
commite6a62c4bb0df7e3d0d3b964237fe111073a748ea (patch)
tree4a811f55807526d9bb17a6d0bd5b2f3028ca7fda /base/runtime
parentde086c316ffc686537490942593f4121621ec61c (diff)
Minor optimization to `map_probe_distance`
Diffstat (limited to 'base/runtime')
-rw-r--r--base/runtime/dynamic_map_internal.odin4
1 files changed, 3 insertions, 1 deletions
diff --git a/base/runtime/dynamic_map_internal.odin b/base/runtime/dynamic_map_internal.odin
index 298b586f5..73a152845 100644
--- a/base/runtime/dynamic_map_internal.odin
+++ b/base/runtime/dynamic_map_internal.odin
@@ -283,7 +283,9 @@ map_desired_position :: #force_inline proc "contextless" (m: Raw_Map, hash: Map_
map_probe_distance :: #force_inline proc "contextless" (m: Raw_Map, hash: Map_Hash, slot: uintptr) -> uintptr {
// We do not use map_cap since we know the capacity will not be zero here.
capacity := uintptr(1) << map_log2_cap(m)
- return (slot + capacity - map_desired_position(m, hash)) & (capacity - 1)
+
+ // return (slot + capacity - map_desired_position(m, hash)) & (capacity - 1)
+ return (slot - uintptr(hash)) & (capacity - 1) // NOTE(bill): this is equivalent to the above, but less operations
}
// When working with the type-erased structure at runtime we need information