Hexadecimal floats for "perfect values" 0h42f60000 == 123; use bit_cast in compiler

This commit is contained in:
gingerBill
2018-02-25 15:09:16 +00:00
parent 27b7dc336a
commit d247ba4751
9 changed files with 70 additions and 54 deletions
+1 -1
View File
@@ -262,7 +262,7 @@ Type *check_assignment_variable(Checker *c, Operand *lhs, Operand *rhs) {
ExactValue v = exact_value_to_integer(rhs->value);
if (v.kind == ExactValue_Integer) {
i64 i = v.value_integer;
u64 u = *cast(u64 *)&i;
u64 u = bit_cast<u64>(i);
u64 umax = ~cast(u64)0ull;
if (lhs_bits < 64) {
umax = (1ull << cast(u64)lhs_bits) - 1ull;