Skip to content

Conversation

fjarri
Copy link
Contributor

@fjarri fjarri commented Dec 29, 2023

  • Add Integer::from_limb_like(), one_like(), and Zero::zero_like(). This is needed in #39
  • Add Monty::params() and as_montgomery()

I do not entirely like from_limb_like, but that's all I could come up with.

Comment on lines +166 to +169
/// The value `1` with the same precision as `other`.
fn one_like(other: &Self) -> Self {
Self::from_limb_like(Limb::ONE, other)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've wondered if we should have a One trait, similar to num_traits::One.

The only reason we don't use num_traits::One is so is_one can return Choice, as it were.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems logical to have such a trait. If we're redefining num_traits::Zero, might as well redefine One too.

@tarcieri tarcieri merged commit 553e72e into RustCrypto:master Dec 29, 2023
@fjarri fjarri deleted the constructors branch December 29, 2023 19:07
@tarcieri tarcieri mentioned this pull request Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants