Skip to content

Commit

Permalink
Address BoxedUint::is_nonzero TODO (#567)
Browse files Browse the repository at this point in the history
  • Loading branch information
tarcieri authored Jan 28, 2024
1 parent 6ccbe74 commit 2a61f1d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 3 additions & 5 deletions src/uint/boxed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,10 @@ impl BoxedUint {
.fold(Choice::from(1), |acc, limb| acc & limb.is_zero())
}

/// Is this [`BoxedUint`] not equal to zero?
/// Is this [`BoxedUint`] *NOT* equal to zero?
#[inline]
pub fn is_nonzero(&self) -> Choice {
// TODO: why not just !self.is_zero()?
self.limbs
.iter()
.fold(Choice::from(0), |acc, limb| acc | limb.is_nonzero().into())
!self.is_zero()
}

/// Is this [`BoxedUint`] equal to one?
Expand Down

0 comments on commit 2a61f1d

Please sign in to comment.