mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Correct map usage
This commit is contained in:
+1
-1
@@ -2192,7 +2192,7 @@ gb_internal void add_min_dep_type_info(Checker *c, Type *t) {
|
|||||||
// IMPORTANT NOTE(bill): this must be copied as `map_set` takes a const ref
|
// IMPORTANT NOTE(bill): this must be copied as `map_set` takes a const ref
|
||||||
// and effectively assigns the `+1` of the value
|
// and effectively assigns the `+1` of the value
|
||||||
isize const count = set->count;
|
isize const count = set->count;
|
||||||
if (map_set_if_not_previously_exists(set, ti_index, count)) {
|
if (map_set_if_not_previously_exists(set, ti_index+1, count)) {
|
||||||
// Type already exists;
|
// Type already exists;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ gb_internal bool lb_init_generator(lbGenerator *gen, Checker *c) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
gen->default_module.gen = gen;
|
gen->default_module.gen = gen;
|
||||||
map_set(&gen->modules, cast(void *)nullptr, &gen->default_module);
|
map_set(&gen->modules, cast(void *)1, &gen->default_module);
|
||||||
lb_init_module(&gen->default_module, c);
|
lb_init_module(&gen->default_module, c);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ gb_internal isize lb_type_info_index(CheckerInfo *info, Type *type, bool err_on_
|
|||||||
auto *set = &info->minimum_dependency_type_info_set;
|
auto *set = &info->minimum_dependency_type_info_set;
|
||||||
isize index = type_info_index(info, type, err_on_not_found);
|
isize index = type_info_index(info, type, err_on_not_found);
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
auto *found = map_get(set, index);
|
auto *found = map_get(set, index+1);
|
||||||
if (found) {
|
if (found) {
|
||||||
GB_ASSERT(*found >= 0);
|
GB_ASSERT(*found >= 0);
|
||||||
return *found + 1;
|
return *found + 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user