@@ -16,7 +16,7 @@ pub mod stream_pippenger;
1616pub use stream_pippenger:: * ;
1717
1818use super :: ScalarMul ;
19- use ark_ff:: biginteger:: { U128OrI128 , U64OrI64 } ;
19+ use ark_ff:: biginteger:: { U128AndSign , U64AndSign } ;
2020
2121#[ cfg( all(
2222 target_has_atomic = "8" ,
@@ -648,7 +648,7 @@ pub fn msm_u128<V: VariableBaseMSM>(
648648/// MSM over mixed-signed 64-bit integers using the small-scalar engine.
649649pub fn msm_u64_or_i64 < V : VariableBaseMSM > (
650650 mut bases : & [ V :: MulBase ] ,
651- mut scalars : & [ U64OrI64 ] ,
651+ mut scalars : & [ U64AndSign ] ,
652652 serial : bool ,
653653) -> V {
654654 // Partition by sign for better locality; build magnitudes as u64.
@@ -663,15 +663,10 @@ pub fn msm_u64_or_i64<V: VariableBaseMSM>(
663663 } ) ;
664664 let ( negative_scalars, non_negative_scalars) : ( Vec < u64 > , Vec < u64 > ) = scalars
665665 . iter ( )
666- . partition_map ( |s| match * s {
667- U64OrI64 :: Unsigned ( u) => Either :: Right ( u) ,
668- U64OrI64 :: Signed ( v) => {
669- if v < 0 {
670- Either :: Left ( v. unsigned_abs ( ) )
671- } else {
672- Either :: Right ( v as u64 )
673- }
674- }
666+ . partition_map ( |s| if s. is_negative ( ) {
667+ Either :: Left ( s. magnitude )
668+ } else {
669+ Either :: Right ( s. magnitude )
675670 } ) ;
676671
677672 if serial {
@@ -698,30 +693,24 @@ pub fn msm_u64_or_i64<V: VariableBaseMSM>(
698693/// MSM over mixed-signed 128-bit integers.
699694pub fn msm_u128_or_i128 < V : VariableBaseMSM > (
700695 mut bases : & [ V :: MulBase ] ,
701- mut scalars : & [ U128OrI128 ] ,
696+ mut scalars : & [ U128AndSign ] ,
702697 serial : bool ,
703698) -> V {
704699 // u128 path with sign partitioning.
705700 let ( negative_bases, non_negative_bases) : ( Vec < V :: MulBase > , Vec < V :: MulBase > ) = bases
706701 . iter ( )
707702 . enumerate ( )
708- . partition_map ( |( i, b) | if match scalars[ i] { U128OrI128 :: Signed ( v ) if v < 0 => true , _ => false } {
703+ . partition_map ( |( i, b) | if scalars[ i] . is_negative ( ) {
709704 Either :: Left ( b)
710705 } else {
711706 Either :: Right ( b)
712707 } ) ;
713708 let ( negative_scalars, non_negative_scalars) : ( Vec < u128 > , Vec < u128 > ) = scalars
714709 . iter ( )
715- . partition_map ( |s| match * s {
716- U128OrI128 :: Unsigned ( u) => Either :: Right ( u) ,
717- U128OrI128 :: Signed ( v) => {
718- let abs = v. unsigned_abs ( ) ;
719- if v < 0 {
720- Either :: Left ( abs)
721- } else {
722- Either :: Right ( abs)
723- }
724- }
710+ . partition_map ( |s| if s. is_negative ( ) {
711+ Either :: Left ( s. magnitude )
712+ } else {
713+ Either :: Right ( s. magnitude )
725714 } ) ;
726715
727716 if serial {
0 commit comments