@@ -44,7 +44,7 @@ impl<M: Modulus> StaticModInt<M> {
44
44
45
45
/// Creates a new `StaticModInt`.
46
46
#[ inline]
47
- pub fn new < T : IntoRepresentative > ( val : T ) -> Self {
47
+ pub fn new < T : RemEuclidU32 > ( val : T ) -> Self {
48
48
Self :: raw ( val. into_representative ( M :: VALUE ) )
49
49
}
50
50
@@ -159,7 +159,7 @@ impl<I: Id> DynamicModInt<I> {
159
159
}
160
160
161
161
#[ inline]
162
- pub fn new < T : IntoRepresentative > ( val : T ) -> Self {
162
+ pub fn new < T : RemEuclidU32 > ( val : T ) -> Self {
163
163
<Self as ModIntBase >:: new ( val)
164
164
}
165
165
@@ -286,7 +286,7 @@ pub trait ModIntBase:
286
286
fn inv ( self ) -> Self ;
287
287
288
288
#[ inline]
289
- fn new < T : IntoRepresentative > ( val : T ) -> Self {
289
+ fn new < T : RemEuclidU32 > ( val : T ) -> Self {
290
290
Self :: raw ( val. into_representative ( Self :: modulus ( ) ) )
291
291
}
292
292
@@ -305,14 +305,14 @@ pub trait ModIntBase:
305
305
}
306
306
}
307
307
308
- pub trait IntoRepresentative {
308
+ pub trait RemEuclidU32 {
309
309
fn into_representative ( self , modulus : u32 ) -> u32 ;
310
310
}
311
311
312
312
macro_rules! impl_into_representative_for_small_signed {
313
313
( $( $ty: tt) ,* ) => {
314
314
$(
315
- impl IntoRepresentative for $ty {
315
+ impl RemEuclidU32 for $ty {
316
316
#[ inline]
317
317
fn into_representative( self , modulus: u32 ) -> u32 {
318
318
( self as i64 ) . rem_euclid( i64 :: from( modulus) ) as _
@@ -324,7 +324,7 @@ macro_rules! impl_into_representative_for_small_signed {
324
324
325
325
impl_into_representative_for_small_signed ! ( i8 , i16 , i32 , i64 , isize ) ;
326
326
327
- impl IntoRepresentative for i128 {
327
+ impl RemEuclidU32 for i128 {
328
328
#[ inline]
329
329
fn into_representative ( self , modulus : u32 ) -> u32 {
330
330
self . rem_euclid ( i128:: from ( modulus) ) as _
@@ -334,7 +334,7 @@ impl IntoRepresentative for i128 {
334
334
macro_rules! impl_into_representative_for_small_unsigned {
335
335
( $( $ty: tt) ,* ) => {
336
336
$(
337
- impl IntoRepresentative for $ty {
337
+ impl RemEuclidU32 for $ty {
338
338
#[ inline]
339
339
fn into_representative( self , modulus: u32 ) -> u32 {
340
340
self as u32 % modulus
@@ -347,7 +347,7 @@ macro_rules! impl_into_representative_for_small_unsigned {
347
347
macro_rules! impl_into_representative_for_large_unsigned {
348
348
( $( $ty: tt) ,* ) => {
349
349
$(
350
- impl IntoRepresentative for $ty {
350
+ impl RemEuclidU32 for $ty {
351
351
#[ inline]
352
352
fn into_representative( self , modulus: u32 ) -> u32 {
353
353
( self % ( modulus as $ty) ) as _
@@ -469,7 +469,7 @@ macro_rules! impl_basic_traits {
469
469
}
470
470
}
471
471
472
- impl <$generic_param: $generic_param_bound, V : IntoRepresentative > From <V > for $self {
472
+ impl <$generic_param: $generic_param_bound, V : RemEuclidU32 > From <V > for $self {
473
473
#[ inline]
474
474
fn from( from: V ) -> Self {
475
475
Self :: new( from)
0 commit comments