aboutsummaryrefslogtreecommitdiff
path: root/src/check_stmt.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2018-01-13 22:26:37 +0000
committergingerBill <bill@gingerbill.org>2018-01-13 22:26:37 +0000
commit6b3c4cc3798177a31fb07e80a6de94cd56c09338 (patch)
treee96f3850976ba42fa5e703150d16dc45a44ec022 /src/check_stmt.cpp
parent37790c13a058aa3f445fe83d399b21f3169d03c1 (diff)
Remove `u128` and `i128`
Diffstat (limited to 'src/check_stmt.cpp')
-rw-r--r--src/check_stmt.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/check_stmt.cpp b/src/check_stmt.cpp
index 6a5084d94..a19ce32fa 100644
--- a/src/check_stmt.cpp
+++ b/src/check_stmt.cpp
@@ -260,16 +260,16 @@ Type *check_assignment_variable(Checker *c, Operand *lhs, Operand *rhs) {
if (rhs->mode == Addressing_Constant) {
ExactValue v = exact_value_to_integer(rhs->value);
if (v.kind == ExactValue_Integer) {
- i128 i = v.value_integer;
- u128 u = *cast(u128 *)&i;
- u128 umax = U128_NEG_ONE;
- if (lhs_bits < 128) {
- umax = u128_sub(u128_shl(U128_ONE, cast(u32)lhs_bits), U128_ONE);
+ i64 i = v.value_integer;
+ u64 u = *cast(u64 *)&i;
+ u64 umax = ~cast(u64)0ull;
+ if (lhs_bits < 64) {
+ umax = (1ull << cast(u64)lhs_bits) - 1ull;
}
- i128 imax = i128_shl(I128_ONE, cast(u32)lhs_bits-1);
+ i64 imax = 1ll << (cast(i64)lhs_bits-1ll);
bool ok = false;
- ok = !(u128_lt(u, U128_ZERO) || u128_gt(u, umax));
+ ok = !(u < 0 || u > umax);
if (ok) {
return rhs->type;