aboutsummaryrefslogtreecommitdiff
path: root/src/checker/type.cpp
diff options
context:
space:
mode:
authorGinger Bill <bill@gingerbill.org>2016-09-04 22:50:17 +0100
committerGinger Bill <bill@gingerbill.org>2016-09-04 22:50:17 +0100
commitae72b3c5bd80fad917a7e2d78d9945b9f19adb52 (patch)
treeab9709537749da05d33aa0888bc7e1aa3984ed03 /src/checker/type.cpp
parentc2e3c3801acd8af32fcf6ea3ad2d3a2ddc94c870 (diff)
Tagged unions memory layout change; begin demo 002
Diffstat (limited to 'src/checker/type.cpp')
-rw-r--r--src/checker/type.cpp6
1 files changed, 3 insertions, 3 deletions
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: {