Skip to content

Commit

Permalink
Handle one more TODO
Browse files Browse the repository at this point in the history
  • Loading branch information
asterite committed Jan 10, 2025
1 parent c10520c commit 0df89c0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions compiler/noirc_evaluator/src/ssa/opt/remove_bit_shifts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,10 @@ impl Context<'_> {
let shifted_complement = self.insert_binary(one_complement, BinaryOp::Div, pow);
// Convert back to 2-complement representation if operand is negative
let lhs_sign_as_int = self.insert_cast(lhs_sign, lhs_typ);
// This shouldn't underflow
// TODO: should this be unchecked?
let shifted = self.insert_binary(
shifted_complement,
BinaryOp::Sub { unchecked: true },
BinaryOp::Sub { unchecked: false },
lhs_sign_as_int,
);
self.insert_truncate(shifted, bit_size, bit_size + 1)
Expand Down
2 changes: 1 addition & 1 deletion compiler/noirc_evaluator/src/ssa/ssa_gen/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ impl<'a> FunctionContext<'a> {
let not_same = self.builder.insert_not(same_sign);
let not_same_sign_field =
self.insert_safe_cast(not_same, NumericType::unsigned(bit_size), location);
// TODO: should this be unchecked?
// Unchecked add because adding 1 to half_width can't overflow
let positive_maximum_with_offset = self.builder.insert_binary(
half_width,
BinaryOp::Add { unchecked: true },
Expand Down

0 comments on commit 0df89c0

Please sign in to comment.