Support matrix literals

This commit is contained in:
gingerBill
2021-10-20 00:40:03 +01:00
parent 662cbaf425
commit 82b6772ea4
10 changed files with 306 additions and 23 deletions
+2 -2
View File
@@ -1967,7 +1967,7 @@ fmt_value :: proc(fi: ^Info, v: any, verb: rune) {
for col in 0..<info.column_count {
if col > 0 { io.write_string(fi.writer, ", ") }
offset := row*info.elem_size + col*info.stride
offset := (row + col*info.elem_stride)*info.elem_size
data := uintptr(v.data) + uintptr(offset)
fmt_arg(fi, any{rawptr(data), info.elem.id}, verb)
@@ -1980,7 +1980,7 @@ fmt_value :: proc(fi: ^Info, v: any, verb: rune) {
for col in 0..<info.column_count {
if col > 0 { io.write_string(fi.writer, "; ") }
offset := row*info.elem_size + col*info.stride
offset := (row + col*info.elem_stride)*info.elem_size
data := uintptr(v.data) + uintptr(offset)
fmt_arg(fi, any{rawptr(data), info.elem.id}, verb)
+1 -1
View File
@@ -165,7 +165,7 @@ Type_Info_Relative_Slice :: struct {
Type_Info_Matrix :: struct {
elem: ^Type_Info,
elem_size: int,
stride: int, // bytes
elem_stride: int,
row_count: int,
column_count: int,
}