ark-curves-cherry-picked/curve-benches/src/macros/utils.rs
curve-benches/src/macros/utils.rsRaw
1macro_rules! n_fold {
2 ($tmp:ident, $v:ident, $func:ident, $count:ident) => {
3 const ITERS: usize = 1000;
4
5 #[cfg(not(feature = "n_fold"))]
6 $tmp.$func(&$v[$count].1);
7 #[cfg(feature = "n_fold")]
8 for _ in 0..ITERS {
9 $tmp.$func(&$v[$count].1);
10 }
11 };
12
13 ($tmp:ident, $func:ident) => {
14 const ITERS: usize = 1000;
15
16 #[cfg(not(feature = "n_fold"))]
17 $tmp.$func();
18 #[cfg(feature = "n_fold")]
19 for _ in 0..ITERS {
20 $tmp.$func();
21 }
22 };
23}
24
25macro_rules! prepared_v {
26 ($v:ident, $rng:ident) => {
27 let $v: Vec<(G1Prepared<Parameters>, G2Prepared<Parameters>)> = (0..SAMPLES)
28 .map(|_| {
29 (
30 G1Affine::from(G1::rand(&mut $rng)).into(),
31 G2Affine::from(G2::rand(&mut $rng)).into(),
32 )
33 })
34 .collect();
35 };
36}
37
38macro_rules! affine_v {
39 ($v:ident, $rng:ident) => {
40 let $v: Vec<(G1Affine, G2Affine)> = (0..SAMPLES)
41 .map(|_| {
42 (
43 G1Affine::from(G1::rand(&mut $rng)).into(),
44 G2Affine::from(G2::rand(&mut $rng)).into(),
45 )
46 })
47 .collect();
48 };
49}