@@ -87,6 +87,7 @@ const fn gte_modulus<C: Fp256Parameters>(x: &BigInteger256) -> bool {
87
87
}
88
88
89
89
#[ ark_ff_asm:: unroll_for_loops]
90
+ #[ inline( always) ]
90
91
const fn conditional_reduce < C : Fp256Parameters > ( x : & mut BigInteger256 ) {
91
92
if gte_modulus :: < C > ( & x) {
92
93
for i in 0 ..9 {
@@ -102,7 +103,7 @@ const fn conditional_reduce<C: Fp256Parameters>(x: &mut BigInteger256) {
102
103
}
103
104
104
105
#[ ark_ff_asm:: unroll_for_loops]
105
- #[ allow ( unused ) ]
106
+ #[ inline ( always ) ]
106
107
fn add_assign < C : Fp256Parameters > ( x : & mut BigInteger256 , y : & BigInteger256 ) {
107
108
let y = & y. 0 ;
108
109
let mut tmp: u32 ;
@@ -274,6 +275,7 @@ impl<C: Fp256Parameters> Fp256<C> {
274
275
} ;
275
276
276
277
#[ ark_ff_asm:: unroll_for_loops]
278
+ #[ inline( always) ]
277
279
const fn const_mul_without_reduce ( & mut self , other : & Self , _modulus : & BigInteger256 , _inv : u32 ) {
278
280
let x = & mut self . 0 . 0 ;
279
281
let y = & other. 0 . 0 ;
@@ -312,11 +314,13 @@ impl<C: Fp256Parameters> Fp256<C> {
312
314
x[ Self :: NLIMBS - 1 ] = xy[ Self :: NLIMBS - 1 ] as u32 ;
313
315
}
314
316
317
+ #[ inline( always) ]
315
318
const fn const_mul ( & mut self , other : & Self , modulus : & BigInteger256 , inv : u32 ) {
316
319
self . const_mul_without_reduce ( other, modulus, inv) ;
317
320
self . const_reduce ( modulus) ;
318
321
}
319
322
323
+ #[ inline( always) ]
320
324
const fn const_reduce ( & mut self , _modulus : & BigInteger256 ) {
321
325
conditional_reduce :: < C > ( & mut self . 0 ) ;
322
326
}
@@ -340,6 +344,7 @@ impl<C: Fp256Parameters> Fp256<C> {
340
344
}
341
345
342
346
#[ ark_ff_asm:: unroll_for_loops]
347
+ #[ inline( always) ]
343
348
const fn const_square ( & mut self ) {
344
349
let mut x = [ 0u64 ; 9 ] ;
345
350
for i in 0 ..9 {
@@ -434,6 +439,7 @@ impl<C: Fp256Parameters> core::ops::DivAssign<Self> for Fp256<C> {
434
439
}
435
440
impl < C : Fp256Parameters > Add < Self > for Fp256 < C > {
436
441
type Output = Self ;
442
+ #[ inline( always) ]
437
443
fn add ( mut self , other : Self ) -> Self {
438
444
self . add_assign ( other) ;
439
445
self
@@ -454,18 +460,21 @@ impl<C: Fp256Parameters> Div<Self> for Fp256<C> {
454
460
}
455
461
}
456
462
impl < C : Fp256Parameters > core:: ops:: AddAssign < Self > for Fp256 < C > {
463
+ #[ inline( always) ]
457
464
fn add_assign ( & mut self , other : Self ) {
458
465
add_assign :: < C > ( & mut self . 0 , & other. 0 )
459
466
}
460
467
}
461
468
impl < C : Fp256Parameters > Mul < Self > for Fp256 < C > {
462
469
type Output = Self ;
470
+ #[ inline( always) ]
463
471
fn mul ( mut self , other : Self ) -> Self {
464
472
self . mul_assign ( other) ;
465
473
self
466
474
}
467
475
}
468
476
impl < C : Fp256Parameters > core:: ops:: MulAssign < Self > for Fp256 < C > {
477
+ #[ inline( always) ]
469
478
fn mul_assign ( & mut self , other : Self ) {
470
479
self . const_mul ( & other, & C :: MODULUS , C :: INV as u32 ) ;
471
480
}
@@ -528,24 +537,28 @@ impl<'a, C: Fp256Parameters> core::iter::Sum<&'a Self> for Fp256<C> {
528
537
}
529
538
impl < ' a , C : Fp256Parameters > Add < & ' a Self > for Fp256 < C > {
530
539
type Output = Self ;
540
+ #[ inline( always) ]
531
541
fn add ( mut self , other : & ' a Self ) -> Self {
532
542
self . add_assign ( other) ;
533
543
self
534
544
}
535
545
}
536
546
impl < ' a , C : Fp256Parameters > core:: ops:: AddAssign < & ' a Self > for Fp256 < C > {
547
+ #[ inline( always) ]
537
548
fn add_assign ( & mut self , other : & ' a Self ) {
538
549
add_assign :: < C > ( & mut self . 0 , & other. 0 )
539
550
}
540
551
}
541
552
impl < ' a , C : Fp256Parameters > Mul < & ' a Self > for Fp256 < C > {
542
553
type Output = Self ;
554
+ #[ inline( always) ]
543
555
fn mul ( mut self , other : & ' a Self ) -> Self {
544
556
self . mul_assign ( other) ;
545
557
self
546
558
}
547
559
}
548
560
impl < ' a , C : Fp256Parameters > core:: ops:: MulAssign < & ' a Self > for Fp256 < C > {
561
+ #[ inline( always) ]
549
562
fn mul_assign ( & mut self , other : & ' a Self ) {
550
563
self . const_mul ( & other, & C :: MODULUS , C :: INV as u32 )
551
564
}
@@ -802,14 +815,13 @@ impl<C: Fp256Parameters> Field for Fp256<C> {
802
815
. and_then ( |f| F :: from_u8 ( flags) . map ( |flag| ( f, flag) ) )
803
816
}
804
817
}
805
- #[ inline]
818
+ #[ inline( always ) ]
806
819
fn square ( & self ) -> Self {
807
820
let mut temp = self . clone ( ) ;
808
821
temp. square_in_place ( ) ;
809
822
temp
810
823
}
811
- #[ inline]
812
- #[ allow( unused_braces, clippy:: absurd_extreme_comparisons) ]
824
+ #[ inline( always) ]
813
825
fn square_in_place ( & mut self ) -> & mut Self {
814
826
self . const_square ( ) ;
815
827
self
0 commit comments