Simplify the handling of the hashing calls for maps

This commit is contained in:
gingerBill
2022-11-13 23:24:08 +00:00
parent a705a2e38b
commit 3edb3d8d8c
3 changed files with 30 additions and 100 deletions
+1 -13
View File
@@ -282,23 +282,11 @@ lbValue lb_equal_proc_for_type(lbModule *m, Type *type) {
lbValue lb_simple_compare_hash(lbProcedure *p, Type *type, lbValue data, lbValue seed) {
GB_ASSERT_MSG(is_type_simple_compare(type), "%s", type_to_string(type));
i64 sz = type_size_of(type);
if (1 <= sz && sz <= 16) {
char name[32] = {};
gb_snprintf(name, 32, "default_hasher%d", cast(i32)sz);
auto args = array_make<lbValue>(permanent_allocator(), 2);
args[0] = data;
args[1] = seed;
return lb_emit_runtime_call(p, name, args);
}
auto args = array_make<lbValue>(permanent_allocator(), 3);
args[0] = data;
args[1] = seed;
args[2] = lb_const_int(p->module, t_int, type_size_of(type));
return lb_emit_runtime_call(p, "default_hasher_n", args);
return lb_emit_runtime_call(p, "default_hasher", args);
}
void lb_add_callsite_force_inline(lbProcedure *p, lbValue ret_value) {