Skip to content
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

refactor: generic size limbs for curve precompiles #417

Merged
merged 19 commits into from
Mar 23, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
cleanup comments
  • Loading branch information
ctian1 committed Mar 21, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 5016a8a5c115ee7a409617bae35bb8389deac994
6 changes: 3 additions & 3 deletions derive/src/lib.rs
Original file line number Diff line number Diff line change
@@ -38,7 +38,7 @@ pub fn aligned_borrow_derive(input: TokenStream) -> TokenStream {
let ast = parse_macro_input!(input as DeriveInput);
let name = &ast.ident;

// Get first generic which must be a type (T in <T, N: NumLimbs>)
// Get first generic which must be type (ex. `T`) for input <T, N: NumLimbs, const M: usize>
let type_generic = ast
.generics
.params
@@ -50,7 +50,7 @@ pub fn aligned_borrow_derive(input: TokenStream) -> TokenStream {
.next()
.expect("Expected at least one generic");

// Get generics after the first (N: NumLimbs, const M: usize in <T, N: NumLimbs, const M: usize>)
// Get generics after the first (ex. `N: NumLimbs, const M: usize`)
// We need this because when we assert the size, we want to substitute u8 for T.
let non_first_generics = ast
.generics
@@ -64,7 +64,7 @@ pub fn aligned_borrow_derive(input: TokenStream) -> TokenStream {
})
.collect::<Vec<_>>();

// Get impl generics (<T, N: NumLimbs>), type generics (<T, N>), where clause (where T: Clone)
// Get impl generics (`<T, N: NumLimbs, const M: usize>`), type generics (`<T, N>`), where clause (`where T: Clone`)
let (impl_generics, type_generics, where_clause) = ast.generics.split_for_impl();

let methods = quote! {
Loading