aboutsummaryrefslogtreecommitdiff
path: root/src/checker/types.cpp
diff options
context:
space:
mode:
authorGinger Bill <bill@gingerbill.org>2016-11-22 21:29:57 +0000
committerGinger Bill <bill@gingerbill.org>2016-11-22 21:29:57 +0000
commitcb7b9a413d66b1dce30a4d810f17ed8453c0a738 (patch)
treedcad81e0edbf4a2619f394c706e0825b162553c7 /src/checker/types.cpp
parent3517f96668636f80cac0ee726bb52976027e47d9 (diff)
Remove Array<T> and replace with macro version
Diffstat (limited to 'src/checker/types.cpp')
-rw-r--r--src/checker/types.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/checker/types.cpp b/src/checker/types.cpp
index c10b8e6f1..8e814b9b6 100644
--- a/src/checker/types.cpp
+++ b/src/checker/types.cpp
@@ -805,14 +805,16 @@ struct BaseTypeSizes {
i64 max_align;
};
+typedef Array(isize) Array_isize;
+
struct Selection {
- Entity *entity;
- Array<isize> index;
- b32 indirect; // Set if there was a pointer deref anywhere down the line
+ Entity * entity;
+ Array_isize index;
+ b32 indirect; // Set if there was a pointer deref anywhere down the line
};
Selection empty_selection = {};
-Selection make_selection(Entity *entity, Array<isize> index, b32 indirect) {
+Selection make_selection(Entity *entity, Array_isize index, b32 indirect) {
Selection s = {entity, index, indirect};
return s;
}
@@ -820,7 +822,7 @@ Selection make_selection(Entity *entity, Array<isize> index, b32 indirect) {
void selection_add_index(Selection *s, isize index) {
// IMPORTANT NOTE(bill): this requires a stretchy buffer/dynamic array so it requires some form
// of heap allocation
- if (s->index.data == NULL) {
+ if (s->index.e == NULL) {
array_init(&s->index, heap_allocator());
}
array_add(&s->index, index);
@@ -1334,7 +1336,7 @@ i64 type_offset_of_from_selection(BaseTypeSizes s, gbAllocator allocator, Type *
Type *t = type;
i64 offset = 0;
for_array(i, sel.index) {
- isize index = sel.index[i];
+ isize index = sel.index.e[i];
t = base_type(t);
offset += type_offset_of(s, allocator, t, index);
if (t->kind == Type_Record && t->Record.kind == TypeRecord_Struct) {