diff options
| author | gingerBill <bill@gingerbill.org> | 2024-05-20 15:04:15 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2024-05-20 15:04:15 +0100 |
| commit | bc706f8b0c18f90dca0cdd664ebb82e8a4305fa3 (patch) | |
| tree | e74d6208b9a6f6a33464e03663418d1f01813e75 | |
| parent | a68c635c0001f4556d468ae6773bd61703c8f560 (diff) | |
Fix indexing type when using a `#row_major` matrix
| -rw-r--r-- | src/check_expr.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp index 32c55228b..013f146f6 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -7755,13 +7755,18 @@ gb_internal bool check_set_index_data(Operand *o, Type *t, bool indirection, i64 return true; case Type_Matrix: - *max_count = t->Matrix.column_count; if (indirection) { o->mode = Addressing_Variable; } else if (o->mode != Addressing_Variable) { o->mode = Addressing_Value; } - o->type = alloc_type_array(t->Matrix.elem, t->Matrix.row_count); + if (t->Matrix.is_row_major) { + *max_count = t->Matrix.row_count; + o->type = alloc_type_array(t->Matrix.elem, t->Matrix.column_count); + } else { + *max_count = t->Matrix.column_count; + o->type = alloc_type_array(t->Matrix.elem, t->Matrix.row_count); + } return true; case Type_Slice: |