Default struct member reordering for minimal size

Rule: largest members to smallest; if same size, order in source order
This commit is contained in:
Ginger Bill
2016-09-10 11:24:50 +01:00
parent 6979678ff9
commit 7509cdceb8
7 changed files with 66 additions and 35 deletions
+1 -1
View File
@@ -6,7 +6,7 @@ print_string_to_buffer :: proc(buf: ^[]byte, s: string) {
// NOTE(bill): This is quite a hack
// TODO(bill): Should I allow the raw editing of a slice by exposing its
// internal members?
Raw_Bytes :: struct {
Raw_Bytes :: struct #ordered {
data: ^byte
len: int
cap: int
+3 -2
View File
@@ -1,13 +1,14 @@
#load "basic.odin"
main :: proc() {
Vector3 :: struct {
Vector4 :: struct {
x: i8
y: i32
z: i16
w: i16
}
v := Vector3{1, 4, 9}
v := Vector4{1, 4, 9, 16}
t := type_info(v)