Skip to content

Commit 7616c3a

Browse files
committed
Rename IntoRepresentative to RemEuclidU32
1 parent 25019f1 commit 7616c3a

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ pub(crate) mod internal_type_traits;
1919

2020
pub use fenwicktree::FenwickTree;
2121
pub use modint::{
22-
Barrett, DefaultId, DynamicModInt, Id, IntoRepresentative, Mod1000000007, Mod998244353, ModInt,
23-
ModInt1000000007, ModInt998244353, Modulus, StaticModInt,
22+
Barrett, DefaultId, DynamicModInt, Id, Mod1000000007, Mod998244353, ModInt, ModInt1000000007,
23+
ModInt998244353, Modulus, RemEuclidU32, StaticModInt,
2424
};

src/modint.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ impl<M: Modulus> StaticModInt<M> {
4444

4545
/// Creates a new `StaticModInt`.
4646
#[inline]
47-
pub fn new<T: IntoRepresentative>(val: T) -> Self {
47+
pub fn new<T: RemEuclidU32>(val: T) -> Self {
4848
Self::raw(val.into_representative(M::VALUE))
4949
}
5050

@@ -159,7 +159,7 @@ impl<I: Id> DynamicModInt<I> {
159159
}
160160

161161
#[inline]
162-
pub fn new<T: IntoRepresentative>(val: T) -> Self {
162+
pub fn new<T: RemEuclidU32>(val: T) -> Self {
163163
<Self as ModIntBase>::new(val)
164164
}
165165

@@ -286,7 +286,7 @@ pub trait ModIntBase:
286286
fn inv(self) -> Self;
287287

288288
#[inline]
289-
fn new<T: IntoRepresentative>(val: T) -> Self {
289+
fn new<T: RemEuclidU32>(val: T) -> Self {
290290
Self::raw(val.into_representative(Self::modulus()))
291291
}
292292

@@ -305,14 +305,14 @@ pub trait ModIntBase:
305305
}
306306
}
307307

308-
pub trait IntoRepresentative {
308+
pub trait RemEuclidU32 {
309309
fn into_representative(self, modulus: u32) -> u32;
310310
}
311311

312312
macro_rules! impl_into_representative_for_small_signed {
313313
($($ty:tt),*) => {
314314
$(
315-
impl IntoRepresentative for $ty {
315+
impl RemEuclidU32 for $ty {
316316
#[inline]
317317
fn into_representative(self, modulus: u32) -> u32 {
318318
(self as i64).rem_euclid(i64::from(modulus)) as _
@@ -324,7 +324,7 @@ macro_rules! impl_into_representative_for_small_signed {
324324

325325
impl_into_representative_for_small_signed!(i8, i16, i32, i64, isize);
326326

327-
impl IntoRepresentative for i128 {
327+
impl RemEuclidU32 for i128 {
328328
#[inline]
329329
fn into_representative(self, modulus: u32) -> u32 {
330330
self.rem_euclid(i128::from(modulus)) as _
@@ -334,7 +334,7 @@ impl IntoRepresentative for i128 {
334334
macro_rules! impl_into_representative_for_small_unsigned {
335335
($($ty:tt),*) => {
336336
$(
337-
impl IntoRepresentative for $ty {
337+
impl RemEuclidU32 for $ty {
338338
#[inline]
339339
fn into_representative(self, modulus: u32) -> u32 {
340340
self as u32 % modulus
@@ -347,7 +347,7 @@ macro_rules! impl_into_representative_for_small_unsigned {
347347
macro_rules! impl_into_representative_for_large_unsigned {
348348
($($ty:tt),*) => {
349349
$(
350-
impl IntoRepresentative for $ty {
350+
impl RemEuclidU32 for $ty {
351351
#[inline]
352352
fn into_representative(self, modulus: u32) -> u32 {
353353
(self % (modulus as $ty)) as _
@@ -469,7 +469,7 @@ macro_rules! impl_basic_traits {
469469
}
470470
}
471471

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 {
473473
#[inline]
474474
fn from(from: V) -> Self {
475475
Self::new(from)

0 commit comments

Comments
 (0)