Skip to content

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

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open

Add big uint conversion #1002

wants to merge 21 commits into from

Conversation

jotabulacios
Copy link
Contributor

Add BigUint conversion

Description

This PR adds try_from operator to create a field element from a BigUint

Type of change

Please delete options that are not relevant.

  • New feature
  • Bug fix
  • Optimization

Checklist

  • Linked to Github Issue
  • Unit tests added
  • This change requires new documentation.
    • Documentation has been added/updated.
  • This change is an Optimization
    • Benchmarks added/run

@codecov-commenter
Copy link

codecov-commenter commented Apr 28, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 72.16%. Comparing base (5f8f2cf) to head (58db229).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jotabulacios jotabulacios marked this pull request as ready for review April 28, 2025 18:36
@jotabulacios jotabulacios requested a review from a team as a code owner April 28, 2025 18:36
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())
Copy link
Contributor

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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Fixed ir here.

Copy link
Contributor

@pablodeymo pablodeymo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants