Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/fns/unconstrained_helpers.nr
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ pub(crate) unconstrained fn __validate_gt_remainder<let N: u32>(

// Only set `borrow` and `carry` if they differ
if (carry != borrow) {
carry_flags[i] = carry as bool;
borrow_flags[i] = borrow as bool;
carry_flags[i] = carry != 0;
borrow_flags[i] = borrow != 0;
}
}
(underflow, result, carry_flags, borrow_flags)
Expand All @@ -95,7 +95,7 @@ pub(crate) unconstrained fn __neg_with_flags<let N: u32>(

borrow_in = borrow;
if (i < N - 1) {
borrow_flags[i] = borrow as bool;
borrow_flags[i] = borrow != 0;
}
}
(result, borrow_flags)
Expand Down Expand Up @@ -134,9 +134,9 @@ pub(crate) unconstrained fn __add_with_flags<let N: u32>(

// Only set `borrow` and `carry` if they differ
if (carry != borrow) {
carry_flags[i] = carry as bool;
carry_flags[i] = carry != 0;
if (i < N - 1) {
borrow_flags[i] = borrow as bool;
borrow_flags[i] = borrow != 0;
}
}
}
Expand Down Expand Up @@ -171,9 +171,9 @@ pub(crate) unconstrained fn __sub_with_flags<let N: u32>(

// Only set `borrow` and `carry` if they differ
if (carry != borrow) {
carry_flags[i] = carry as bool;
carry_flags[i] = carry != 0;
if (i < N - 1) {
borrow_flags[i] = borrow as bool;
borrow_flags[i] = borrow != 0;
}
}
}
Expand Down