@@ -5,8 +5,7 @@ use proc_macro::TokenStream;
5
5
use quote:: format_ident;
6
6
use syn:: {
7
7
parse:: { Parse , ParseStream } ,
8
- parse_macro_input, ExprPath , Token ,
9
- LitStr ,
8
+ parse_macro_input, ExprPath , LitStr , Token ,
10
9
} ;
11
10
12
11
/// This macro generates the code to setup the elliptic curve for a given modular type. Also it
@@ -71,11 +70,7 @@ pub fn sw_declare(input: TokenStream) -> TokenStream {
71
70
macro_rules! create_extern_func {
72
71
( $name: ident) => {
73
72
let $name = syn:: Ident :: new(
74
- & format!(
75
- "{}_{}" ,
76
- stringify!( $name) ,
77
- struct_name_str
78
- ) ,
73
+ & format!( "{}_{}" , stringify!( $name) , struct_name_str) ,
79
74
span. into( ) ,
80
75
) ;
81
76
} ;
@@ -204,7 +199,7 @@ pub fn sw_declare(input: TokenStream) -> TokenStream {
204
199
// (EcAdd only) p2 is (x2, y2), and x1 - x2 has to be non-zero to avoid division over zero in add.
205
200
let p2 = [ one. as_ref( ) , one. as_ref( ) ] . concat( ) ;
206
201
let mut uninit: core:: mem:: MaybeUninit <[ Self ; 2 ] > = core:: mem:: MaybeUninit :: uninit( ) ;
207
-
202
+
208
203
unsafe { #sw_setup_extern_func( uninit. as_mut_ptr( ) as * mut core:: ffi:: c_void, p1. as_ptr( ) , p2. as_ptr( ) ) ; }
209
204
<#intmod_type as openvm_algebra_guest:: IntMod >:: set_up_once( ) ;
210
205
true
@@ -425,7 +420,7 @@ impl Parse for SwDefine {
425
420
fn parse ( input : ParseStream ) -> syn:: Result < Self > {
426
421
let items = input. parse_terminated ( <LitStr as Parse >:: parse, Token ! [ , ] ) ?;
427
422
Ok ( Self {
428
- items : items. into_iter ( ) . map ( |e| e. value ( ) ) . collect ( )
423
+ items : items. into_iter ( ) . map ( |e| e. value ( ) ) . collect ( ) ,
429
424
} )
430
425
}
431
426
}
@@ -499,7 +494,7 @@ pub fn sw_init(input: TokenStream) -> TokenStream {
499
494
rs1 = In p1,
500
495
rs2 = Const "x0" // will be parsed as 0 and therefore transpiled to SETUP_EC_DOUBLE
501
496
) ;
502
-
497
+
503
498
504
499
}
505
500
}
0 commit comments