@@ -449,7 +449,7 @@ macro_rules! int_impl {
449
449
#[ inline]
450
450
pub const fn checked_add( self , rhs: Self ) -> Option <Self > {
451
451
let ( a, b) = self . overflowing_add( rhs) ;
452
- if unlikely! ( b ) { None } else { Some ( a) }
452
+ if b { None } else { Some ( a) }
453
453
}
454
454
455
455
/// Strict integer addition. Computes `self + rhs`, panicking
@@ -484,7 +484,7 @@ macro_rules! int_impl {
484
484
#[ track_caller]
485
485
pub const fn strict_add( self , rhs: Self ) -> Self {
486
486
let ( a, b) = self . overflowing_add( rhs) ;
487
- if unlikely! ( b ) { overflow_panic:: add( ) } else { a }
487
+ if b { overflow_panic:: add( ) } else { a }
488
488
}
489
489
490
490
/// Unchecked integer addition. Computes `self + rhs`, assuming overflow
@@ -545,7 +545,7 @@ macro_rules! int_impl {
545
545
#[ inline]
546
546
pub const fn checked_add_unsigned( self , rhs: $UnsignedT) -> Option <Self > {
547
547
let ( a, b) = self . overflowing_add_unsigned( rhs) ;
548
- if unlikely! ( b ) { None } else { Some ( a) }
548
+ if b { None } else { Some ( a) }
549
549
}
550
550
551
551
/// Strict addition with an unsigned integer. Computes `self + rhs`,
@@ -580,7 +580,7 @@ macro_rules! int_impl {
580
580
#[ track_caller]
581
581
pub const fn strict_add_unsigned( self , rhs: $UnsignedT) -> Self {
582
582
let ( a, b) = self . overflowing_add_unsigned( rhs) ;
583
- if unlikely! ( b ) { overflow_panic:: add( ) } else { a }
583
+ if b { overflow_panic:: add( ) } else { a }
584
584
}
585
585
586
586
/// Checked integer subtraction. Computes `self - rhs`, returning `None` if
@@ -601,7 +601,7 @@ macro_rules! int_impl {
601
601
#[ inline]
602
602
pub const fn checked_sub( self , rhs: Self ) -> Option <Self > {
603
603
let ( a, b) = self . overflowing_sub( rhs) ;
604
- if unlikely! ( b ) { None } else { Some ( a) }
604
+ if b { None } else { Some ( a) }
605
605
}
606
606
607
607
/// Strict integer subtraction. Computes `self - rhs`, panicking if
@@ -636,7 +636,7 @@ macro_rules! int_impl {
636
636
#[ track_caller]
637
637
pub const fn strict_sub( self , rhs: Self ) -> Self {
638
638
let ( a, b) = self . overflowing_sub( rhs) ;
639
- if unlikely! ( b ) { overflow_panic:: sub( ) } else { a }
639
+ if b { overflow_panic:: sub( ) } else { a }
640
640
}
641
641
642
642
/// Unchecked integer subtraction. Computes `self - rhs`, assuming overflow
@@ -697,7 +697,7 @@ macro_rules! int_impl {
697
697
#[ inline]
698
698
pub const fn checked_sub_unsigned( self , rhs: $UnsignedT) -> Option <Self > {
699
699
let ( a, b) = self . overflowing_sub_unsigned( rhs) ;
700
- if unlikely! ( b ) { None } else { Some ( a) }
700
+ if b { None } else { Some ( a) }
701
701
}
702
702
703
703
/// Strict subtraction with an unsigned integer. Computes `self - rhs`,
@@ -732,7 +732,7 @@ macro_rules! int_impl {
732
732
#[ track_caller]
733
733
pub const fn strict_sub_unsigned( self , rhs: $UnsignedT) -> Self {
734
734
let ( a, b) = self . overflowing_sub_unsigned( rhs) ;
735
- if unlikely! ( b ) { overflow_panic:: sub( ) } else { a }
735
+ if b { overflow_panic:: sub( ) } else { a }
736
736
}
737
737
738
738
/// Checked integer multiplication. Computes `self * rhs`, returning `None` if
@@ -753,7 +753,7 @@ macro_rules! int_impl {
753
753
#[ inline]
754
754
pub const fn checked_mul( self , rhs: Self ) -> Option <Self > {
755
755
let ( a, b) = self . overflowing_mul( rhs) ;
756
- if unlikely! ( b ) { None } else { Some ( a) }
756
+ if b { None } else { Some ( a) }
757
757
}
758
758
759
759
/// Strict integer multiplication. Computes `self * rhs`, panicking if
@@ -788,7 +788,7 @@ macro_rules! int_impl {
788
788
#[ track_caller]
789
789
pub const fn strict_mul( self , rhs: Self ) -> Self {
790
790
let ( a, b) = self . overflowing_mul( rhs) ;
791
- if unlikely! ( b ) { overflow_panic:: mul( ) } else { a }
791
+ if b { overflow_panic:: mul( ) } else { a }
792
792
}
793
793
794
794
/// Unchecked integer multiplication. Computes `self * rhs`, assuming overflow
@@ -849,7 +849,7 @@ macro_rules! int_impl {
849
849
without modifying the original"]
850
850
#[ inline]
851
851
pub const fn checked_div( self , rhs: Self ) -> Option <Self > {
852
- if unlikely! ( rhs == 0 || ( ( self == Self :: MIN ) && ( rhs == -1 ) ) ) {
852
+ if rhs == 0 || ( ( self == Self :: MIN ) && ( rhs == -1 ) ) {
853
853
None
854
854
} else {
855
855
// SAFETY: div by zero and by INT_MIN have been checked above
@@ -902,7 +902,7 @@ macro_rules! int_impl {
902
902
#[ track_caller]
903
903
pub const fn strict_div( self , rhs: Self ) -> Self {
904
904
let ( a, b) = self . overflowing_div( rhs) ;
905
- if unlikely! ( b ) { overflow_panic:: div( ) } else { a }
905
+ if b { overflow_panic:: div( ) } else { a }
906
906
}
907
907
908
908
/// Checked Euclidean division. Computes `self.div_euclid(rhs)`,
@@ -924,7 +924,7 @@ macro_rules! int_impl {
924
924
#[ inline]
925
925
pub const fn checked_div_euclid( self , rhs: Self ) -> Option <Self > {
926
926
// Using `&` helps LLVM see that it is the same check made in division.
927
- if unlikely! ( rhs == 0 || ( ( self == Self :: MIN ) & ( rhs == -1 ) ) ) {
927
+ if rhs == 0 || ( ( self == Self :: MIN ) & ( rhs == -1 ) ) {
928
928
None
929
929
} else {
930
930
Some ( self . div_euclid( rhs) )
@@ -976,7 +976,7 @@ macro_rules! int_impl {
976
976
#[ track_caller]
977
977
pub const fn strict_div_euclid( self , rhs: Self ) -> Self {
978
978
let ( a, b) = self . overflowing_div_euclid( rhs) ;
979
- if unlikely! ( b ) { overflow_panic:: div( ) } else { a }
979
+ if b { overflow_panic:: div( ) } else { a }
980
980
}
981
981
982
982
/// Checked integer remainder. Computes `self % rhs`, returning `None` if
@@ -997,7 +997,7 @@ macro_rules! int_impl {
997
997
without modifying the original"]
998
998
#[ inline]
999
999
pub const fn checked_rem( self , rhs: Self ) -> Option <Self > {
1000
- if unlikely! ( rhs == 0 || ( ( self == Self :: MIN ) && ( rhs == -1 ) ) ) {
1000
+ if rhs == 0 || ( ( self == Self :: MIN ) && ( rhs == -1 ) ) {
1001
1001
None
1002
1002
} else {
1003
1003
// SAFETY: div by zero and by INT_MIN have been checked above
@@ -1049,7 +1049,7 @@ macro_rules! int_impl {
1049
1049
#[ track_caller]
1050
1050
pub const fn strict_rem( self , rhs: Self ) -> Self {
1051
1051
let ( a, b) = self . overflowing_rem( rhs) ;
1052
- if unlikely! ( b ) { overflow_panic:: rem( ) } else { a }
1052
+ if b { overflow_panic:: rem( ) } else { a }
1053
1053
}
1054
1054
1055
1055
/// Checked Euclidean remainder. Computes `self.rem_euclid(rhs)`, returning `None`
@@ -1071,7 +1071,7 @@ macro_rules! int_impl {
1071
1071
#[ inline]
1072
1072
pub const fn checked_rem_euclid( self , rhs: Self ) -> Option <Self > {
1073
1073
// Using `&` helps LLVM see that it is the same check made in division.
1074
- if unlikely! ( rhs == 0 || ( ( self == Self :: MIN ) & ( rhs == -1 ) ) ) {
1074
+ if rhs == 0 || ( ( self == Self :: MIN ) & ( rhs == -1 ) ) {
1075
1075
None
1076
1076
} else {
1077
1077
Some ( self . rem_euclid( rhs) )
@@ -1122,7 +1122,7 @@ macro_rules! int_impl {
1122
1122
#[ track_caller]
1123
1123
pub const fn strict_rem_euclid( self , rhs: Self ) -> Self {
1124
1124
let ( a, b) = self . overflowing_rem_euclid( rhs) ;
1125
- if unlikely! ( b ) { overflow_panic:: rem( ) } else { a }
1125
+ if b { overflow_panic:: rem( ) } else { a }
1126
1126
}
1127
1127
1128
1128
/// Checked negation. Computes `-self`, returning `None` if `self == MIN`.
@@ -1142,7 +1142,7 @@ macro_rules! int_impl {
1142
1142
#[ inline]
1143
1143
pub const fn checked_neg( self ) -> Option <Self > {
1144
1144
let ( a, b) = self . overflowing_neg( ) ;
1145
- if unlikely! ( b ) { None } else { Some ( a) }
1145
+ if b { None } else { Some ( a) }
1146
1146
}
1147
1147
1148
1148
/// Unchecked negation. Computes `-self`, assuming overflow cannot occur.
@@ -1210,7 +1210,7 @@ macro_rules! int_impl {
1210
1210
#[ track_caller]
1211
1211
pub const fn strict_neg( self ) -> Self {
1212
1212
let ( a, b) = self . overflowing_neg( ) ;
1213
- if unlikely! ( b ) { overflow_panic:: neg( ) } else { a }
1213
+ if b { overflow_panic:: neg( ) } else { a }
1214
1214
}
1215
1215
1216
1216
/// Checked shift left. Computes `self << rhs`, returning `None` if `rhs` is larger
@@ -1273,7 +1273,7 @@ macro_rules! int_impl {
1273
1273
#[ track_caller]
1274
1274
pub const fn strict_shl( self , rhs: u32 ) -> Self {
1275
1275
let ( a, b) = self . overflowing_shl( rhs) ;
1276
- if unlikely! ( b ) { overflow_panic:: shl( ) } else { a }
1276
+ if b { overflow_panic:: shl( ) } else { a }
1277
1277
}
1278
1278
1279
1279
/// Unchecked shift left. Computes `self << rhs`, assuming that
@@ -1371,7 +1371,7 @@ macro_rules! int_impl {
1371
1371
#[ track_caller]
1372
1372
pub const fn strict_shr( self , rhs: u32 ) -> Self {
1373
1373
let ( a, b) = self . overflowing_shr( rhs) ;
1374
- if unlikely! ( b ) { overflow_panic:: shr( ) } else { a }
1374
+ if b { overflow_panic:: shr( ) } else { a }
1375
1375
}
1376
1376
1377
1377
/// Unchecked shift right. Computes `self >> rhs`, assuming that
@@ -2458,7 +2458,7 @@ macro_rules! int_impl {
2458
2458
without modifying the original"]
2459
2459
pub const fn overflowing_div( self , rhs: Self ) -> ( Self , bool ) {
2460
2460
// Using `&` helps LLVM see that it is the same check made in division.
2461
- if unlikely! ( ( self == Self :: MIN ) & ( rhs == -1 ) ) {
2461
+ if ( self == Self :: MIN ) & ( rhs == -1 ) {
2462
2462
( self , true )
2463
2463
} else {
2464
2464
( self / rhs, false )
@@ -2489,7 +2489,7 @@ macro_rules! int_impl {
2489
2489
without modifying the original"]
2490
2490
pub const fn overflowing_div_euclid( self , rhs: Self ) -> ( Self , bool ) {
2491
2491
// Using `&` helps LLVM see that it is the same check made in division.
2492
- if unlikely! ( ( self == Self :: MIN ) & ( rhs == -1 ) ) {
2492
+ if ( self == Self :: MIN ) & ( rhs == -1 ) {
2493
2493
( self , true )
2494
2494
} else {
2495
2495
( self . div_euclid( rhs) , false )
@@ -2519,7 +2519,7 @@ macro_rules! int_impl {
2519
2519
#[ must_use = "this returns the result of the operation, \
2520
2520
without modifying the original"]
2521
2521
pub const fn overflowing_rem( self , rhs: Self ) -> ( Self , bool ) {
2522
- if unlikely! ( rhs == -1 ) {
2522
+ if rhs == -1 {
2523
2523
( 0 , self == Self :: MIN )
2524
2524
} else {
2525
2525
( self % rhs, false )
@@ -2551,7 +2551,7 @@ macro_rules! int_impl {
2551
2551
#[ inline]
2552
2552
#[ track_caller]
2553
2553
pub const fn overflowing_rem_euclid( self , rhs: Self ) -> ( Self , bool ) {
2554
- if unlikely! ( rhs == -1 ) {
2554
+ if rhs == -1 {
2555
2555
( 0 , self == Self :: MIN )
2556
2556
} else {
2557
2557
( self . rem_euclid( rhs) , false )
@@ -2580,7 +2580,7 @@ macro_rules! int_impl {
2580
2580
without modifying the original"]
2581
2581
#[ allow( unused_attributes) ]
2582
2582
pub const fn overflowing_neg( self ) -> ( Self , bool ) {
2583
- if unlikely! ( self == Self :: MIN ) {
2583
+ if self == Self :: MIN {
2584
2584
( Self :: MIN , true )
2585
2585
} else {
2586
2586
( -self , false )
0 commit comments