diff --git a/core/_preload.odin b/core/_preload.odin index b0c269bf8..792a108e0 100644 --- a/core/_preload.odin +++ b/core/_preload.odin @@ -1132,7 +1132,7 @@ __dynamic_map_delete :: proc(using h: __Map_Header, key: __Map_Key) { __dynamic_map_get_entry :: proc(using h: __Map_Header, index: int) -> ^__Map_Entry_Header { assert(0 <= index && index < m.entries.len); - return cast(^__Map_Entry_Header)(cast(^byte)m.entries.data + index*entry_size); + return cast(^__Map_Entry_Header)(uintptr(m.entries.data) + uintptr(index*entry_size)); } __dynamic_map_erase :: proc(using h: __Map_Header, fr: __Map_Find_Result) { diff --git a/src/ir.cpp b/src/ir.cpp index 068ed50f4..d68cae587 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -7628,22 +7628,12 @@ void ir_init_module(irModule *m, Checker *c) { { // Add type info data { - isize max_index = -1; - for_array(type_info_map_index, m->info->type_info_map.entries) { - auto *entry = &m->info->type_info_map.entries[type_info_map_index]; - Type *t = cast(Type *)entry->key.ptr; - t = default_type(t); - isize entry_index = type_info_index(m->info, t); - if (max_index < entry_index) { - max_index = entry_index; - } - } - isize max_type_info_count = max_index+1; + isize max_type_info_count = m->info->type_info_types.count; String name = str_lit(IR_TYPE_INFO_DATA_NAME); Entity *e = make_entity_variable(m->allocator, nullptr, make_token_ident(name), make_type_array(m->allocator, t_type_info, max_type_info_count), false); irValue *g = ir_value_global(m->allocator, e, nullptr); - g->Global.is_private = true; + g->Global.is_private = true; ir_module_add_value(m, e, g); map_set(&m->members, hash_string(name), g); ir_global_type_info_data = g; @@ -7654,9 +7644,8 @@ void ir_init_module(irModule *m, Checker *c) { // NOTE(bill): Removes need for heap allocation by making it global memory isize count = 0; - for_array(entry_index, m->info->type_info_map.entries) { - auto *entry = &m->info->type_info_map.entries[entry_index]; - Type *t = cast(Type *)entry->key.ptr; + for_array(entry_index, m->info->type_info_types) { + Type *t = m->info->type_info_types[entry_index]; switch (t->kind) { case Type_Union: