diff options
| author | gingerBill <bill@gingerbill.org> | 2018-02-25 19:23:52 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2018-02-25 19:23:52 +0000 |
| commit | d63885a495d2314a5ef76337605a9ebeefb26218 (patch) | |
| tree | a47a575251d0be0020e3120e970e71ba55d3a651 /src/types.cpp | |
| parent | f28a34fa99d68ce54c76272385ff9c172cc2ae59 (diff) | |
`array_make`
Diffstat (limited to 'src/types.cpp')
| -rw-r--r-- | src/types.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/types.cpp b/src/types.cpp index 1f9724578..95b13d78f 100644 --- a/src/types.cpp +++ b/src/types.cpp @@ -1522,8 +1522,7 @@ Selection lookup_field_from_index(gbAllocator a, Type *type, i64 index) { Entity *f = type->Struct.fields[i]; if (f->kind == Entity_Variable) { if (f->Variable.field_src_index == index) { - Array<i32> sel_array = {0}; - array_init_count(&sel_array, a, 1); + auto sel_array = array_make<i32>(a, 1); sel_array[0] = cast(i32)i; return make_selection(f, sel_array, false); } @@ -1534,8 +1533,7 @@ Selection lookup_field_from_index(gbAllocator a, Type *type, i64 index) { for (isize i = 0; i < max_count; i++) { Entity *f = type->Tuple.variables[i]; if (i == index) { - Array<i32> sel_array = {0}; - array_init_count(&sel_array, a, 1); + auto sel_array = array_make<i32>(a, 1); sel_array[0] = cast(i32)i; return make_selection(f, sel_array, false); } @@ -1543,8 +1541,7 @@ Selection lookup_field_from_index(gbAllocator a, Type *type, i64 index) { break; case Type_BitField: { - Array<i32> sel_array = {0}; - array_init_count(&sel_array, a, 1); + auto sel_array = array_make<i32>(a, 1); sel_array[0] = cast(i32)index; return make_selection(type->BitField.fields[index], sel_array, false); } break; @@ -1979,8 +1976,7 @@ i64 type_align_of_internal(gbAllocator allocator, Type *t, TypePath *path) { } Array<i64> type_set_offsets_of(gbAllocator allocator, Array<Entity *> fields, bool is_packed, bool is_raw_union) { - Array<i64> offsets = {}; - array_init_count(&offsets, allocator, fields.count); + auto offsets = array_make<i64>(allocator, fields.count); i64 curr_offset = 0; if (is_raw_union) { for_array(i, fields) { |