diff options
| author | gingerBill <bill@gingerbill.org> | 2024-08-05 12:33:02 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2024-08-05 12:33:02 +0100 |
| commit | fd06be2243db3fa193702f881947eaa5f2ebf24b (patch) | |
| tree | 1e1eb977f9949aedf056b8fc1ecc7b5ce938b254 /src | |
| parent | a06cb8ba46e8a116c8968565eef055fc56ec298e (diff) | |
Allow `swizzle` to take more arguments than the original array length
Diffstat (limited to 'src')
| -rw-r--r-- | src/check_builtin.cpp | 2 | ||||
| -rw-r--r-- | src/llvm_backend_expr.cpp | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/check_builtin.cpp b/src/check_builtin.cpp index b6b1f9874..b96337326 100644 --- a/src/check_builtin.cpp +++ b/src/check_builtin.cpp @@ -2460,7 +2460,7 @@ gb_internal bool check_builtin_procedure(CheckerContext *c, Operand *operand, As arg_count++; } - if (arg_count > max_count) { + if (false && arg_count > max_count) { error(call, "Too many 'swizzle' indices, %td > %td", arg_count, max_count); return false; } else if (arg_count < 2) { diff --git a/src/llvm_backend_expr.cpp b/src/llvm_backend_expr.cpp index 1f0719e13..59d5cce23 100644 --- a/src/llvm_backend_expr.cpp +++ b/src/llvm_backend_expr.cpp @@ -3814,7 +3814,7 @@ gb_internal lbAddr lb_build_array_swizzle_addr(lbProcedure *p, AstCallExpr *ce, Type *type = base_type(lb_addr_type(addr)); GB_ASSERT(type->kind == Type_Array); i64 count = type->Array.count; - if (count <= 4) { + if (count <= 4 && index_count <= 4) { u8 indices[4] = {}; u8 index_count = 0; for (i32 i = 1; i < ce->args.count; i++) { |