diff options
| author | gingerBill <bill@gingerbill.org> | 2022-08-08 15:07:00 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2022-08-08 15:07:00 +0100 |
| commit | 5e3cf45df3e781b0e5e01a55490a32bed0d9c7e3 (patch) | |
| tree | a77078831df35c7b232a4c55714c00a22a48782c /core/runtime | |
| parent | 4633591918030497728675a026a45dda6201ea83 (diff) | |
Add `#soa` pointer type to aid with refactoring to `#soa` data types
a: #soa[16]Foo
p := &a[6]
#assert(type_of(p) == #soa^#soa[16]Foo)
p^.x = 123
p.x = 123
Diffstat (limited to 'core/runtime')
| -rw-r--r-- | core/runtime/core.odin | 10 | ||||
| -rw-r--r-- | core/runtime/print.odin | 3 |
2 files changed, 13 insertions, 0 deletions
diff --git a/core/runtime/core.odin b/core/runtime/core.odin index 8fb3d7210..0310aff6d 100644 --- a/core/runtime/core.odin +++ b/core/runtime/core.odin @@ -176,6 +176,9 @@ Type_Info_Matrix :: struct { column_count: int, // Total element count = column_count * elem_stride } +Type_Info_Soa_Pointer :: struct { + elem: ^Type_Info, +} Type_Info_Flag :: enum u8 { Comparable = 0, @@ -217,6 +220,7 @@ Type_Info :: struct { Type_Info_Relative_Pointer, Type_Info_Relative_Slice, Type_Info_Matrix, + Type_Info_Soa_Pointer, }, } @@ -403,6 +407,12 @@ Raw_Cstring :: struct { data: [^]byte, } +Raw_Soa_Pointer :: struct { + data: rawptr, + index: int, +} + + /* // Defined internally by the compiler diff --git a/core/runtime/print.odin b/core/runtime/print.odin index 89c196fc2..959dad3a9 100644 --- a/core/runtime/print.odin +++ b/core/runtime/print.odin @@ -228,6 +228,9 @@ print_type :: proc "contextless" (ti: ^Type_Info) { case Type_Info_Multi_Pointer: print_string("[^]") print_type(info.elem) + case Type_Info_Soa_Pointer: + print_string("#soa ^") + print_type(info.elem) case Type_Info_Procedure: print_string("proc") if info.params == nil { |