-
Notifications
You must be signed in to change notification settings - Fork 249
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
Make short_weierstrass::Affine
's infinity
flag conditional
#639
base: master
Are you sure you want to change the base?
Conversation
Note that I'm not sure this is necessarily a change that we want: the resulting UX is worse (implementors of For the first issue, maybe we can provide a macro or something that automatically makes the choice for end users. For the second issue, we should benchmark and see if there's perf differences. |
@@ -30,6 +33,9 @@ pub trait SWCurveConfig: super::CurveConfig { | |||
/// Generator of the prime-order subgroup. | |||
const GENERATOR: Affine<Self>; | |||
|
|||
/// A type that is stored in `Affine<Self>` to indicate whether the point is at infinity. | |||
type ZeroIndicator: ZeroInd<Self>; |
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.
Not really happy with this name; happy to take suggestions for better name.
@@ -198,3 +204,30 @@ pub trait SWCurveConfig: super::CurveConfig { | |||
} | |||
} | |||
} | |||
|
|||
pub trait ZeroInd<C: SWCurveConfig>: |
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.
Same for this.
Description
This PR allows
short_weierstrass::Affine
's layout to conditionally contain abool
flag indicating whether or not it is zero. This is helpful for compressing the representation of the point in memory. Note that due to the unfortunate lack of associated type defaults, we cannot set the type of the flag to bebool
by default.In the future, it would be nice to automatically derive this from certain conditions (e.g.,
A.is_zero()
)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