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:
gingerBill
2024-03-19 21:05:23 +00:00
parent 433109ff52
commit a750fc0ba6
12 changed files with 105 additions and 30 deletions

View File

@@ -2329,6 +2329,19 @@ gb_internal Ast *parse_operand(AstFile *f, bool lhs) {
break;
}
return original_type;
} else if (name.string == "row_major" ||
name.string == "column_major") {
Ast *original_type = parse_type(f);
Ast *type = unparen_expr(original_type);
switch (type->kind) {
case Ast_MatrixType:
type->MatrixType.is_row_major = (name.string == "row_major");
break;
default:
syntax_error(type, "Expected a matrix type after #%.*s, got %.*s", LIT(name.string), LIT(ast_strings[type->kind]));
break;
}
return original_type;
} else if (name.string == "partial") {
Ast *tag = ast_basic_directive(f, token, name);
Ast *original_expr = parse_expr(f, lhs);