From 998da2c2da72853cff9ceeb86d07ad20bb81a8c6 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Sun, 21 Dec 2025 17:09:22 +0000 Subject: [PATCH] Add `reflect.default_map_hash_by_ptr` --- core/reflect/reflect.odin | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/reflect/reflect.odin b/core/reflect/reflect.odin index 5fbff08c2..378c50ff0 100644 --- a/core/reflect/reflect.odin +++ b/core/reflect/reflect.odin @@ -2003,4 +2003,14 @@ equal :: proc(a, b: any, including_indirect_array_recursion := false, recursion_ runtime.print_typeid(a.id) runtime.print_string("\n") return true +} + + +@(require_results) +default_map_hash_by_ptr :: proc(ptr: ^$T, seed: uintptr = runtime.INITIAL_HASH_SEED) -> uintptr where intrinsics.type_is_comparable(T) { + assert(ptr != nil) + + info := intrinsics.type_map_info(map[T]struct{}) + + return info.key_hasher(ptr, seed) } \ No newline at end of file