diff options
| author | Ginger Bill <bill@gingerbill.org> | 2017-04-19 18:58:23 +0100 |
|---|---|---|
| committer | Ginger Bill <bill@gingerbill.org> | 2017-04-19 18:58:23 +0100 |
| commit | c5411a25a94650ec6370eea3572d3d60f6240482 (patch) | |
| tree | 5e19a6d25cb1d00b765ff4b1acb7193582b27da6 /src/types.c | |
| parent | 95692fda52320b6f6128d75f08ae5ac0e17c4857 (diff) | |
Change Union representation for LLVM IR; fix dynamic array size
Diffstat (limited to 'src/types.c')
| -rw-r--r-- | src/types.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/types.c b/src/types.c index 8869505a9..22c7eea64 100644 --- a/src/types.c +++ b/src/types.c @@ -1779,9 +1779,10 @@ i64 *type_set_offsets_of(gbAllocator allocator, Entity **fields, isize field_cou } else { for (isize i = 0; i < field_count; i++) { i64 align = type_align_of(allocator, fields[i]->type); + i64 size = type_size_of(allocator, fields[i]->type); curr_offset = align_formula(curr_offset, align); offsets[i] = curr_offset; - curr_offset += type_size_of(allocator, fields[i]->type); + curr_offset += size; } } return offsets; @@ -1861,7 +1862,8 @@ i64 type_size_of_internal(gbAllocator allocator, Type *t, TypePath *path) { } break; case Type_DynamicArray: - return 3*build_context.word_size + type_size_of(allocator, t_allocator); + // data + len + cap + allocator(procedure+data) + return 3*build_context.word_size + 2*build_context.word_size; case Type_Vector: { #if 0 |