diff options
| author | gingerBill <bill@gingerbill.org> | 2021-11-08 11:40:41 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2021-11-08 11:40:41 +0000 |
| commit | 23f0fbc376bc4065d0d9391415e10ea6d9b43d96 (patch) | |
| tree | 30bbc1fb7dcfd3b7c12cdb6bae60369dc61659aa /src/types.cpp | |
| parent | 1296fabe2c933c350315efacb0961ce794505eab (diff) | |
Improve matrix->matrix casting implementation
Diffstat (limited to 'src/types.cpp')
| -rw-r--r-- | src/types.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/types.cpp b/src/types.cpp index 52bb2e324..652d383ee 100644 --- a/src/types.cpp +++ b/src/types.cpp @@ -1417,7 +1417,14 @@ i64 matrix_row_major_index_to_offset(Type *t, i64 index) { i64 row_index = index/t->Matrix.column_count; return matrix_indices_to_offset(t, row_index, column_index); } - +i64 matrix_column_major_index_to_offset(Type *t, i64 index) { + t = base_type(t); + GB_ASSERT(t->kind == Type_Matrix); + + i64 row_index = index%t->Matrix.row_count; + i64 column_index = index/t->Matrix.row_count; + return matrix_indices_to_offset(t, row_index, column_index); +} bool is_matrix_square(Type *t) { |