Merge pull request #6583 from Znarf64/fix_array_count

Fix array counts for floats that are exactly representable as ints eg. [1.1e4]int
This commit is contained in:
gingerBill
2026-04-17 09:52:11 +01:00
committed by GitHub

View File

@@ -2840,6 +2840,12 @@ gb_internal i64 check_array_count(CheckerContext *ctx, Operand *o, Ast *e) {
error(e, "Array count too large, %.*s", LIT(str));
gb_free(a, str.text);
return 0;
} else if (o->value.kind == ExactValue_Float) {
u64 u = cast(u64)o->value.value_float;
f64 f = cast(f64)u;
if (f == o->value.value_float) {
return u;
}
}
}