- 
                Notifications
    You must be signed in to change notification settings 
- Fork 70
          Additional methods for Integer and Monty
          #533
        
          New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
|  | @@ -158,6 +158,19 @@ pub trait Integer: | |
| /// The value `1`. | ||
| fn one() -> Self; | ||
|  | ||
| /// The value `0` with the same precision as `other`. | ||
| fn zero_like(other: &Self) -> Self { | ||
| Self::from_limb_like(Limb::ZERO, other) | ||
| } | ||
|  | ||
| /// The value `1` with the same precision as `other`. | ||
| fn one_like(other: &Self) -> Self { | ||
| Self::from_limb_like(Limb::ONE, other) | ||
| } | ||
| 
      Comment on lines
    
      +161
     to 
      +164
    
   There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've wondered if we should have a  The only reason we don't use  There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems logical to have such a trait. If we're redefining  | ||
|  | ||
| /// Returns an integer with the first limb set to `limb`, and the same precision as `other`. | ||
| fn from_limb_like(limb: Limb, other: &Self) -> Self; | ||
|  | ||
| /// Number of limbs in this integer. | ||
| fn nlimbs(&self) -> usize; | ||
|  | ||
|  | @@ -787,6 +800,12 @@ pub trait Monty: | |
| /// Returns one in this representation. | ||
| fn one(params: Self::Params) -> Self; | ||
|  | ||
| /// Returns the parameter struct used to initialize this object. | ||
| fn params(&self) -> &Self::Params; | ||
|  | ||
| /// Access the value in Montgomery form. | ||
| fn as_montgomery(&self) -> &Self::Integer; | ||
|         
                  tarcieri marked this conversation as resolved.
              Show resolved
            Hide resolved | ||
|  | ||
| /// Performs division by 2, that is returns `x` such that `x + x = self`. | ||
| fn div_by_2(&self) -> Self; | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.