@@ -750,9 +750,9 @@ $EndFeature, "
750
750
}
751
751
752
752
doc_comment! {
753
- concat!( "Unchecked integer addition. Computes `self + rhs, assuming overflow
753
+ concat!( "Unchecked integer addition. Computes `self + rhs` , assuming overflow
754
754
cannot occur. This results in undefined behavior when `self + rhs > " , stringify!( $SelfT) ,
755
- "::max_value() ` or `self + rhs < " , stringify!( $SelfT) , "::min_value() `." ) ,
755
+ "::MAX ` or `self + rhs < " , stringify!( $SelfT) , "::MIN `." ) ,
756
756
#[ unstable(
757
757
feature = "unchecked_math" ,
758
758
reason = "niche optimization path" ,
@@ -792,9 +792,9 @@ $EndFeature, "
792
792
}
793
793
794
794
doc_comment! {
795
- concat!( "Unchecked integer subtraction. Computes `self - rhs, assuming overflow
795
+ concat!( "Unchecked integer subtraction. Computes `self - rhs` , assuming overflow
796
796
cannot occur. This results in undefined behavior when `self - rhs > " , stringify!( $SelfT) ,
797
- "::max_value() ` or `self - rhs < " , stringify!( $SelfT) , "::min_value() `." ) ,
797
+ "::MAX ` or `self - rhs < " , stringify!( $SelfT) , "::MIN `." ) ,
798
798
#[ unstable(
799
799
feature = "unchecked_math" ,
800
800
reason = "niche optimization path" ,
@@ -834,9 +834,9 @@ $EndFeature, "
834
834
}
835
835
836
836
doc_comment! {
837
- concat!( "Unchecked integer multiplication. Computes `self * rhs, assuming overflow
837
+ concat!( "Unchecked integer multiplication. Computes `self * rhs` , assuming overflow
838
838
cannot occur. This results in undefined behavior when `self * rhs > " , stringify!( $SelfT) ,
839
- "::max_value() ` or `self * rhs < " , stringify!( $SelfT) , "::min_value() `." ) ,
839
+ "::MAX ` or `self * rhs < " , stringify!( $SelfT) , "::MIN `." ) ,
840
840
#[ unstable(
841
841
feature = "unchecked_math" ,
842
842
reason = "niche optimization path" ,
@@ -871,7 +871,7 @@ $EndFeature, "
871
871
without modifying the original"]
872
872
#[ inline]
873
873
pub const fn checked_div( self , rhs: Self ) -> Option <Self > {
874
- if rhs == 0 || ( self == Self :: min_value ( ) && rhs == -1 ) {
874
+ if rhs == 0 || ( self == Self :: MIN && rhs == -1 ) {
875
875
None
876
876
} else {
877
877
// SAFETY: div by zero and by INT_MIN have been checked above
@@ -900,7 +900,7 @@ assert_eq!((1", stringify!($SelfT), ").checked_div_euclid(0), None);
900
900
without modifying the original"]
901
901
#[ inline]
902
902
pub const fn checked_div_euclid( self , rhs: Self ) -> Option <Self > {
903
- if rhs == 0 || ( self == Self :: min_value ( ) && rhs == -1 ) {
903
+ if rhs == 0 || ( self == Self :: MIN && rhs == -1 ) {
904
904
None
905
905
} else {
906
906
Some ( self . div_euclid( rhs) )
@@ -929,7 +929,7 @@ $EndFeature, "
929
929
without modifying the original"]
930
930
#[ inline]
931
931
pub const fn checked_rem( self , rhs: Self ) -> Option <Self > {
932
- if rhs == 0 || ( self == Self :: min_value ( ) && rhs == -1 ) {
932
+ if rhs == 0 || ( self == Self :: MIN && rhs == -1 ) {
933
933
None
934
934
} else {
935
935
// SAFETY: div by zero and by INT_MIN have been checked above
@@ -957,7 +957,7 @@ assert_eq!(", stringify!($SelfT), "::MIN.checked_rem_euclid(-1), None);
957
957
without modifying the original"]
958
958
#[ inline]
959
959
pub const fn checked_rem_euclid( self , rhs: Self ) -> Option <Self > {
960
- if rhs == 0 || ( self == Self :: min_value ( ) && rhs == -1 ) {
960
+ if rhs == 0 || ( self == Self :: MIN && rhs == -1 ) {
961
961
None
962
962
} else {
963
963
Some ( self . rem_euclid( rhs) )
@@ -1236,9 +1236,9 @@ $EndFeature, "
1236
1236
match self . checked_mul( rhs) {
1237
1237
Some ( x) => x,
1238
1238
None => if ( self < 0 ) == ( rhs < 0 ) {
1239
- Self :: max_value ( )
1239
+ Self :: MAX
1240
1240
} else {
1241
- Self :: min_value ( )
1241
+ Self :: MIN
1242
1242
}
1243
1243
}
1244
1244
}
@@ -1267,8 +1267,8 @@ $EndFeature, "
1267
1267
pub const fn saturating_pow( self , exp: u32 ) -> Self {
1268
1268
match self . checked_pow( exp) {
1269
1269
Some ( x) => x,
1270
- None if self < 0 && exp % 2 == 1 => Self :: min_value ( ) ,
1271
- None => Self :: max_value ( ) ,
1270
+ None if self < 0 && exp % 2 == 1 => Self :: MIN ,
1271
+ None => Self :: MAX ,
1272
1272
}
1273
1273
}
1274
1274
}
@@ -1738,7 +1738,7 @@ $EndFeature, "
1738
1738
#[ must_use = "this returns the result of the operation, \
1739
1739
without modifying the original"]
1740
1740
pub const fn overflowing_div( self , rhs: Self ) -> ( Self , bool ) {
1741
- if self == Self :: min_value ( ) && rhs == -1 {
1741
+ if self == Self :: MIN && rhs == -1 {
1742
1742
( self , true )
1743
1743
} else {
1744
1744
( self / rhs, false )
@@ -1771,7 +1771,7 @@ assert_eq!(", stringify!($SelfT), "::MIN.overflowing_div_euclid(-1), (", stringi
1771
1771
#[ must_use = "this returns the result of the operation, \
1772
1772
without modifying the original"]
1773
1773
pub const fn overflowing_div_euclid( self , rhs: Self ) -> ( Self , bool ) {
1774
- if self == Self :: min_value ( ) && rhs == -1 {
1774
+ if self == Self :: MIN && rhs == -1 {
1775
1775
( self , true )
1776
1776
} else {
1777
1777
( self . div_euclid( rhs) , false )
@@ -1805,7 +1805,7 @@ $EndFeature, "
1805
1805
#[ must_use = "this returns the result of the operation, \
1806
1806
without modifying the original"]
1807
1807
pub const fn overflowing_rem( self , rhs: Self ) -> ( Self , bool ) {
1808
- if self == Self :: min_value ( ) && rhs == -1 {
1808
+ if self == Self :: MIN && rhs == -1 {
1809
1809
( 0 , true )
1810
1810
} else {
1811
1811
( self % rhs, false )
@@ -1838,7 +1838,7 @@ assert_eq!(", stringify!($SelfT), "::MIN.overflowing_rem_euclid(-1), (0, true));
1838
1838
without modifying the original"]
1839
1839
#[ inline]
1840
1840
pub const fn overflowing_rem_euclid( self , rhs: Self ) -> ( Self , bool ) {
1841
- if self == Self :: min_value ( ) && rhs == -1 {
1841
+ if self == Self :: MIN && rhs == -1 {
1842
1842
( 0 , true )
1843
1843
} else {
1844
1844
( self . rem_euclid( rhs) , false )
@@ -1869,8 +1869,8 @@ assert_eq!(", stringify!($SelfT), "::MIN.overflowing_neg(), (", stringify!($Self
1869
1869
#[ allow( unused_attributes) ]
1870
1870
#[ allow_internal_unstable( const_if_match) ]
1871
1871
pub const fn overflowing_neg( self ) -> ( Self , bool ) {
1872
- if self == Self :: min_value ( ) {
1873
- ( Self :: min_value ( ) , true )
1872
+ if self == Self :: MIN {
1873
+ ( Self :: MIN , true )
1874
1874
} else {
1875
1875
( -self , false )
1876
1876
}
@@ -1952,7 +1952,7 @@ $EndFeature, "
1952
1952
#[ rustc_const_stable( feature = "const_int_methods" , since = "1.32.0" ) ]
1953
1953
#[ inline]
1954
1954
pub const fn overflowing_abs( self ) -> ( Self , bool ) {
1955
- ( self . wrapping_abs( ) , self == Self :: min_value ( ) )
1955
+ ( self . wrapping_abs( ) , self == Self :: MIN )
1956
1956
}
1957
1957
}
1958
1958
@@ -2986,9 +2986,9 @@ assert_eq!((", stringify!($SelfT), "::MAX - 2).checked_add(3), None);", $EndFeat
2986
2986
}
2987
2987
2988
2988
doc_comment! {
2989
- concat!( "Unchecked integer addition. Computes `self + rhs, assuming overflow
2989
+ concat!( "Unchecked integer addition. Computes `self + rhs` , assuming overflow
2990
2990
cannot occur. This results in undefined behavior when `self + rhs > " , stringify!( $SelfT) ,
2991
- "::max_value() ` or `self + rhs < " , stringify!( $SelfT) , "::min_value() `." ) ,
2991
+ "::MAX ` or `self + rhs < " , stringify!( $SelfT) , "::MIN `." ) ,
2992
2992
#[ unstable(
2993
2993
feature = "unchecked_math" ,
2994
2994
reason = "niche optimization path" ,
@@ -3026,9 +3026,9 @@ assert_eq!(0", stringify!($SelfT), ".checked_sub(1), None);", $EndFeature, "
3026
3026
}
3027
3027
3028
3028
doc_comment! {
3029
- concat!( "Unchecked integer subtraction. Computes `self - rhs, assuming overflow
3029
+ concat!( "Unchecked integer subtraction. Computes `self - rhs` , assuming overflow
3030
3030
cannot occur. This results in undefined behavior when `self - rhs > " , stringify!( $SelfT) ,
3031
- "::max_value() ` or `self - rhs < " , stringify!( $SelfT) , "::min_value() `." ) ,
3031
+ "::MAX ` or `self - rhs < " , stringify!( $SelfT) , "::MIN `." ) ,
3032
3032
#[ unstable(
3033
3033
feature = "unchecked_math" ,
3034
3034
reason = "niche optimization path" ,
@@ -3066,9 +3066,9 @@ assert_eq!(", stringify!($SelfT), "::MAX.checked_mul(2), None);", $EndFeature, "
3066
3066
}
3067
3067
3068
3068
doc_comment! {
3069
- concat!( "Unchecked integer multiplication. Computes `self * rhs, assuming overflow
3069
+ concat!( "Unchecked integer multiplication. Computes `self * rhs` , assuming overflow
3070
3070
cannot occur. This results in undefined behavior when `self * rhs > " , stringify!( $SelfT) ,
3071
- "::max_value() ` or `self * rhs < " , stringify!( $SelfT) , "::min_value() `." ) ,
3071
+ "::MAX ` or `self * rhs < " , stringify!( $SelfT) , "::MIN `." ) ,
3072
3072
#[ unstable(
3073
3073
feature = "unchecked_math" ,
3074
3074
reason = "niche optimization path" ,
@@ -3367,7 +3367,7 @@ assert_eq!((", stringify!($SelfT), "::MAX).saturating_mul(10), ", stringify!($Se
3367
3367
pub const fn saturating_mul( self , rhs: Self ) -> Self {
3368
3368
match self . checked_mul( rhs) {
3369
3369
Some ( x) => x,
3370
- None => Self :: max_value ( ) ,
3370
+ None => Self :: MAX ,
3371
3371
}
3372
3372
}
3373
3373
}
@@ -3394,7 +3394,7 @@ $EndFeature, "
3394
3394
pub const fn saturating_pow( self , exp: u32 ) -> Self {
3395
3395
match self . checked_pow( exp) {
3396
3396
Some ( x) => x,
3397
- None => Self :: max_value ( ) ,
3397
+ None => Self :: MAX ,
3398
3398
}
3399
3399
}
3400
3400
}
@@ -4081,7 +4081,7 @@ Basic usage:
4081
4081
}
4082
4082
}
4083
4083
4084
- doc_comment! {
4084
+ doc_comment! {
4085
4085
concat!( "Performs Euclidean division.
4086
4086
4087
4087
Since, for the positive integers, all common
@@ -4179,7 +4179,7 @@ assert!(!10", stringify!($SelfT), ".is_power_of_two());", $EndFeature, "
4179
4179
// (such as intel pre-haswell) have more efficient ctlz
4180
4180
// intrinsics when the argument is non-zero.
4181
4181
let z = unsafe { intrinsics:: ctlz_nonzero( p) } ;
4182
- <$SelfT>:: max_value ( ) >> z
4182
+ <$SelfT>:: MAX >> z
4183
4183
}
4184
4184
4185
4185
doc_comment! {
@@ -5161,9 +5161,9 @@ trait FromStrRadixHelper: PartialOrd + Copy {
5161
5161
macro_rules! doit {
5162
5162
( $( $t: ty) * ) => ( $( impl FromStrRadixHelper for $t {
5163
5163
#[ inline]
5164
- fn min_value( ) -> Self { Self :: min_value ( ) }
5164
+ fn min_value( ) -> Self { Self :: MIN }
5165
5165
#[ inline]
5166
- fn max_value( ) -> Self { Self :: max_value ( ) }
5166
+ fn max_value( ) -> Self { Self :: MAX }
5167
5167
#[ inline]
5168
5168
fn from_u32( u: u32 ) -> Self { u as Self }
5169
5169
#[ inline]
0 commit comments