From 57f5976ac1b5416093ef25d725c30ae5ff270809 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Sun, 29 Nov 2020 16:12:21 +0000 Subject: Support map keys for simple compare types --- src/ir.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/ir.cpp') diff --git a/src/ir.cpp b/src/ir.cpp index cb60b9e3b..84f943eda 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -5006,8 +5006,14 @@ irValue *ir_get_hasher_proc_for_type(irModule *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(permanent_allocator(), 3); + args[0] = data; + args[1] = seed; + args[2] = ir_const_int(sz); + irValue *res = ir_emit_runtime_call(proc, "default_hasher_n", args); + ir_emit(proc, ir_instr_return(proc, res)); } else if (is_type_cstring(type)) { auto args = array_make(permanent_allocator(), 2); args[0] = data; -- cgit v1.2.3