-
Notifications
You must be signed in to change notification settings - Fork 48
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
Feat: Implement Pod
trait on Uint types
#292
Conversation
…Zeroable for all Uint types
}; | ||
} | ||
|
||
impl_pod! { |
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.
is it possible to replace this with a generic_const_expr
usage when cfg(feature = "nightly")
?
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.
Can you provide more insight on what this might look like? I can take a look into updating the implementation to use generic_const_expr
when nightly is enabled.
Would you want this updated before merging the current changes?
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.
Just following up on this, let me know what you think. I'm happy to take a look into it if this would be blocking to get the PR merged.
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 don't consider this a blocker
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #292 +/- ##
==========================================
+ Coverage 82.66% 82.67% +0.01%
==========================================
Files 52 53 +1
Lines 5648 5681 +33
==========================================
+ Hits 4669 4697 +28
- Misses 979 984 +5
☔ View full report in Codecov by Sentry. |
// 64, and using `Uint` sizes not divisible by 64 would violate Pod's | ||
// guarantees potentially leading to undefined behavior. | ||
macro_rules! impl_pod { | ||
($(($bits:expr, $limbs:expr)),+ $(,)?) => { |
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.
nit: these are really literal
, as non-literal expr
are invalid in this context. no change needed
Motivation
This PR implements the
Pod
trait onUint
types where the size is a multiple of 64, up to 1024. This allowsUint
types within this range to be used in instances where aPod
trait bound exists.Solution
This implementation uses a simple macro to implement the
Pod
trait on the following Uint sizes listed below.PR Checklist