-
Notifications
You must be signed in to change notification settings - Fork 154
Add big uint conversion #1002
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
base: main
Are you sure you want to change the base?
Add big uint conversion #1002
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1002 +/- ##
==========================================
+ Coverage 72.06% 72.16% +0.10%
==========================================
Files 160 160
Lines 35145 35262 +117
==========================================
+ Hits 25327 25447 +120
+ Misses 9818 9815 -3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…aworks into add_BigUint_conversion
…aworks into add_BigUint_conversion
crates/math/src/field/element.rs
Outdated
let mut bytes = value.to_bytes_le(); | ||
// We pad the bytes to the size of the base type to be able to apply `from_bytes_le`. | ||
bytes.resize(core::mem::size_of::<F::BaseType>(), 0); | ||
Ok(Self::from_bytes_le(&bytes).unwrap()) |
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.
the unwrap is note necessary and the Ok as well
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.
Thanks! Fixed ir here.
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.
fix comment
Add BigUint conversion
Description
This PR adds
try_from
operator to create a field element from aBigUint
Type of change
Please delete options that are not relevant.
Checklist