Support map keys for simple compare types

This commit is contained in:
gingerBill
2020-11-29 16:12:21 +00:00
parent 7fbc081119
commit 57f5976ac1
5 changed files with 26 additions and 7 deletions
+8 -2
View File
@@ -9284,8 +9284,14 @@ lbValue lb_get_hasher_proc_for_type(lbModule *m, Type *type) {
if (type->kind == Type_Struct) {
type_set_offsets(type);
GB_PANIC("Type_Struct");
GB_ASSERT(is_type_simple_compare(type));
i64 sz = type_size_of(type);
auto args = array_make<lbValue>(permanent_allocator(), 3);
args[0] = data;
args[1] = seed;
args[2] = lb_const_int(m, t_int, sz);
lbValue res = lb_emit_runtime_call(p, "default_hasher_n", args);
LLVMBuildRet(p->builder, res.value);
} else if (is_type_cstring(type)) {
auto args = array_make<lbValue>(permanent_allocator(), 2);
args[0] = data;