mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-03 22:28:46 +00:00
Add #row_major matrix[R, C]T
As well as `#column_major matrix[R, C]T` as an alias for just `matrix[R, C]T`. This is because some libraries require a row_major internal layout but still want to be used with row or major oriented vectors.
This commit is contained in:
+10
-2
@@ -2396,7 +2396,11 @@ fmt_matrix :: proc(fi: ^Info, v: any, verb: rune, info: runtime.Type_Info_Matrix
|
||||
for col in 0..<info.column_count {
|
||||
if col > 0 { io.write_string(fi.writer, ", ", &fi.n) }
|
||||
|
||||
offset := (row + col*info.elem_stride)*info.elem_size
|
||||
offset: int
|
||||
switch info.layout {
|
||||
case .Column_Major: offset = (row + col*info.elem_stride)*info.elem_size
|
||||
case .Row_Major: offset = (col + row*info.elem_stride)*info.elem_size
|
||||
}
|
||||
|
||||
data := uintptr(v.data) + uintptr(offset)
|
||||
fmt_arg(fi, any{rawptr(data), info.elem.id}, verb)
|
||||
@@ -2410,7 +2414,11 @@ fmt_matrix :: proc(fi: ^Info, v: any, verb: rune, info: runtime.Type_Info_Matrix
|
||||
for col in 0..<info.column_count {
|
||||
if col > 0 { io.write_string(fi.writer, ", ", &fi.n) }
|
||||
|
||||
offset := (row + col*info.elem_stride)*info.elem_size
|
||||
offset: int
|
||||
switch info.layout {
|
||||
case .Column_Major: offset = (row + col*info.elem_stride)*info.elem_size
|
||||
case .Row_Major: offset = (col + row*info.elem_stride)*info.elem_size
|
||||
}
|
||||
|
||||
data := uintptr(v.data) + uintptr(offset)
|
||||
fmt_arg(fi, any{rawptr(data), info.elem.id}, verb)
|
||||
|
||||
Reference in New Issue
Block a user