apply abs fix to constant system too

This commit is contained in:
Laytan Laats
2025-02-06 21:06:25 +01:00
parent b1068c7f2e
commit de83ad2a25
2 changed files with 8 additions and 5 deletions
+5 -2
View File
@@ -3488,9 +3488,12 @@ gb_internal bool check_builtin_procedure(CheckerContext *c, Operand *operand, As
case ExactValue_Integer:
mp_abs(&operand->value.value_integer, &operand->value.value_integer);
break;
case ExactValue_Float:
operand->value.value_float = gb_abs(operand->value.value_float);
case ExactValue_Float: {
u64 abs = bit_cast<u64>(operand->value.value_float);
abs &= 0x7FFFFFFFFFFFFFFF;
operand->value.value_float = bit_cast<f64>(abs);
break;
}
case ExactValue_Complex: {
f64 r = operand->value.value_complex->real;
f64 i = operand->value.value_complex->imag;
+3 -3
View File
@@ -2175,9 +2175,9 @@ gb_internal lbValue lb_build_builtin_proc(lbProcedure *p, Ast *expr, TypeAndValu
}
GB_PANIC("Unknown complex type");
} else if (is_type_float(t)) {
Type *t_float;
Type *t_unsigned;
lbValue mask;
Type *t_float = nullptr;
Type *t_unsigned = nullptr;
lbValue mask = {0};
switch (type_size_of(t)) {
case 2:
t_float = t_f16;