-
Notifications
You must be signed in to change notification settings - Fork 278
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
BigInt const generics #372
Conversation
cc @tarcieri |
I talked with @Pratyush about This PR is doing something somewhat similar, but the main difference would be It sure would be nice to have one place to collaborate on these sorts of problems. |
One additional thing we might want to consider doing is moving all the impls in the traits directly to inherent methods, and having the trait forward to those inherent impls. This would enable calling the |
@@ -102,7 +103,7 @@ impl FpParameters for FrParameters { | |||
]); | |||
|
|||
// (mod - 1) / 2 = 2972938801625915898129258746014768257744324656783561314222519104145798272973804394996417217026588261812051162269696 | |||
const MODULUS_MINUS_ONE_DIV_TWO: BigInteger = BigInteger([ | |||
const MODULUS_MINUS_ONE_DIV_TWO: BigInteger = BigInt::<6>([ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can use the BigInteger::new
method here to avoid specifying the number of limbs. (It's unfortunate that we can't use the type alias as the constructor =()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto for the fixes in curves
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One repo needs to move first. It can be algebra.
This is what One workaround is to keep the intrinsics in the trait impls, and const pure Rust. |
Good point.
Yeah, that's a good trade-off, but in that case we might need to name the inherent and trait methods differently, to avoid accidentally using the slower one. Maybe it's just better to wait for |
Description
This is an updated PR based on the subset of #186, i.e. replacing the macros with const generics only for BigInt crate. As such, it should be easier to merge.
Breaking change -> will need an accompanying PR in the curves repo.
Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.
Pending
section inCHANGELOG.md
Files changed
in the GitHub PR explorer