Skip to content

Commit

Permalink
Do cast in both cases
Browse files Browse the repository at this point in the history
  • Loading branch information
asterite committed Jan 10, 2025
1 parent 4683b0d commit cf1a9e7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/noirc_evaluator/src/ssa/opt/remove_bit_shifts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,9 @@ impl Context<'_> {
let lhs_typ = self.function.dfg.type_of_value(lhs).unwrap_numeric();
let base = self.field_constant(FieldElement::from(2_u128));
let pow = self.pow(base, rhs);
let pow = self.insert_cast(pow, lhs_typ);
if lhs_typ.is_unsigned() {
// unsigned right bit shift is just a normal division
let pow = self.insert_cast(pow, lhs_typ);
self.insert_binary(lhs, BinaryOp::Div, pow)
} else {
// Get the sign of the operand; positive signed operand will just do a division as well
Expand Down

0 comments on commit cf1a9e7

Please sign in to comment.