From ae72b3c5bd80fad917a7e2d78d9945b9f19adb52 Mon Sep 17 00:00:00 2001 From: Ginger Bill Date: Sun, 4 Sep 2016 22:50:17 +0100 Subject: Tagged unions memory layout change; begin demo 002 --- src/checker/type.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/checker/type.cpp') diff --git a/src/checker/type.cpp b/src/checker/type.cpp index ed8b16ef1..e2971ed9f 100644 --- a/src/checker/type.cpp +++ b/src/checker/type.cpp @@ -117,8 +117,8 @@ struct Type { // All record types // Theses are arrays - Entity **fields; // Entity_Variable - isize field_count; // == offset_count + Entity **fields; // Entity_Variable (otherwise Entity_TypeName if union) + isize field_count; // == offset_count is struct AstNode *node; // enum only @@ -909,7 +909,7 @@ i64 type_size_of(BaseTypeSizes s, gbAllocator allocator, Type *t) { if (max < size) max = size; } - return type_size_of(s, allocator, t_int) + max; + return align_formula(max, s.max_align) + type_size_of(s, allocator, t_int); } break; case TypeRecord_RawUnion: { -- cgit v1.2.3