aboutsummaryrefslogtreecommitdiff
path: root/src/ir.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2021-03-02 16:48:39 +0000
committergingerBill <bill@gingerbill.org>2021-03-02 16:48:39 +0000
commitc2794b62a92f6805723ee1b5bed1622858671478 (patch)
treec4b78706ae0e6dc7de52eeaa991534e310327ae3 /src/ir.cpp
parent4e63ab5edcb1785df2d90c4de6f885dc57e45e7d (diff)
Clean up logic for `<<` and `>>` behaviour
Diffstat (limited to 'src/ir.cpp')
-rw-r--r--src/ir.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/ir.cpp b/src/ir.cpp
index c54e91f17..810621d67 100644
--- a/src/ir.cpp
+++ b/src/ir.cpp
@@ -4630,8 +4630,8 @@ handle_op:
irValue *bits = right;
- irValue *max = ir_value_constant(type, exact_value_i64(8*type_size_of(type) - 1));
- irValue *less_equal_width = ir_emit(proc, ir_instr_binary_op(proc, Token_LtEq, bits, max, t_llvm_bool));
+ irValue *max = ir_value_constant(type, exact_value_i64(8*type_size_of(type)));
+ irValue *less_equal_width = ir_emit(proc, ir_instr_binary_op(proc, Token_Lt, bits, max, t_llvm_bool));
irValue *zero = ir_value_constant(type, exact_value_i64(0));
@@ -4646,8 +4646,8 @@ handle_op:
irValue *bits = right;
- irValue *max = ir_value_constant(type, exact_value_i64(8*type_size_of(type) - 1));
- irValue *less_equal_width = ir_emit(proc, ir_instr_binary_op(proc, Token_LtEq, bits, max, t_llvm_bool));
+ irValue *max = ir_value_constant(type, exact_value_i64(8*type_size_of(type)));
+ irValue *less_equal_width = ir_emit(proc, ir_instr_binary_op(proc, Token_Lt, bits, max, t_llvm_bool));
bits = ir_emit_select(proc, less_equal_width, bits, max);
return ir_emit(proc, ir_instr_binary_op(proc, op, left, bits, type));