get rid of the internal unlikely macro · qinheping/verify-rust-std@6daffe4 (original) (raw)
`@@ -449,7 +449,7 @@ macro_rules! int_impl {
`
449
449
` #[inline]
`
450
450
`pub const fn checked_add(self, rhs: Self) -> Option {
`
451
451
`let (a, b) = self.overflowing_add(rhs);
`
452
``
`-
if unlikely!(b) { None } else { Some(a) }
`
``
452
`+
if intrinsics::unlikely(b) { None } else { Some(a) }
`
453
453
`}
`
454
454
``
455
455
`` /// Strict integer addition. Computes self + rhs
, panicking
``
`@@ -545,7 +545,7 @@ macro_rules! int_impl {
`
545
545
` #[inline]
`
546
546
`pub const fn checked_add_unsigned(self, rhs: $UnsignedT) -> Option {
`
547
547
`let (a, b) = self.overflowing_add_unsigned(rhs);
`
548
``
`-
if unlikely!(b) { None } else { Some(a) }
`
``
548
`+
if intrinsics::unlikely(b) { None } else { Some(a) }
`
549
549
`}
`
550
550
``
551
551
`` /// Strict addition with an unsigned integer. Computes self + rhs
,
``
`@@ -601,7 +601,7 @@ macro_rules! int_impl {
`
601
601
` #[inline]
`
602
602
`pub const fn checked_sub(self, rhs: Self) -> Option {
`
603
603
`let (a, b) = self.overflowing_sub(rhs);
`
604
``
`-
if unlikely!(b) { None } else { Some(a) }
`
``
604
`+
if intrinsics::unlikely(b) { None } else { Some(a) }
`
605
605
`}
`
606
606
``
607
607
`` /// Strict integer subtraction. Computes self - rhs
, panicking if
``
`@@ -697,7 +697,7 @@ macro_rules! int_impl {
`
697
697
` #[inline]
`
698
698
`pub const fn checked_sub_unsigned(self, rhs: $UnsignedT) -> Option {
`
699
699
`let (a, b) = self.overflowing_sub_unsigned(rhs);
`
700
``
`-
if unlikely!(b) { None } else { Some(a) }
`
``
700
`+
if intrinsics::unlikely(b) { None } else { Some(a) }
`
701
701
`}
`
702
702
``
703
703
`` /// Strict subtraction with an unsigned integer. Computes self - rhs
,
``
`@@ -753,7 +753,7 @@ macro_rules! int_impl {
`
753
753
` #[inline]
`
754
754
`pub const fn checked_mul(self, rhs: Self) -> Option {
`
755
755
`let (a, b) = self.overflowing_mul(rhs);
`
756
``
`-
if unlikely!(b) { None } else { Some(a) }
`
``
756
`+
if intrinsics::unlikely(b) { None } else { Some(a) }
`
757
757
`}
`
758
758
``
759
759
`` /// Strict integer multiplication. Computes self * rhs
, panicking if
``
`@@ -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 {
`
852
``
`-
if unlikely!(rhs == 0 || ((self == Self::MIN) && (rhs == -1))) {
`
``
852
`+
if intrinsics::unlikely(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
`
`@@ -924,7 +924,7 @@ macro_rules! int_impl {
`
924
924
` #[inline]
`
925
925
`pub const fn checked_div_euclid(self, rhs: Self) -> Option {
`
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 intrinsics::unlikely(rhs == 0 || ((self == Self::MIN) & (rhs == -1))) {
`
928
928
`None
`
929
929
`} else {
`
930
930
`Some(self.div_euclid(rhs))
`
`@@ -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 {
`
1000
``
`-
if unlikely!(rhs == 0 || ((self == Self::MIN) && (rhs == -1))) {
`
``
1000
`+
if intrinsics::unlikely(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
`
`@@ -1071,7 +1071,7 @@ macro_rules! int_impl {
`
1071
1071
` #[inline]
`
1072
1072
`pub const fn checked_rem_euclid(self, rhs: Self) -> Option {
`
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 intrinsics::unlikely(rhs == 0 || ((self == Self::MIN) & (rhs == -1))) {
`
1075
1075
`None
`
1076
1076
`} else {
`
1077
1077
`Some(self.rem_euclid(rhs))
`
`@@ -1142,7 +1142,7 @@ macro_rules! int_impl {
`
1142
1142
` #[inline]
`
1143
1143
`pub const fn checked_neg(self) -> Option {
`
1144
1144
`let (a, b) = self.overflowing_neg();
`
1145
``
`-
if unlikely!(b) { None } else { Some(a) }
`
``
1145
`+
if intrinsics::unlikely(b) { None } else { Some(a) }
`
1146
1146
`}
`
1147
1147
``
1148
1148
`` /// Unchecked negation. Computes -self
, assuming overflow cannot occur.
``
`@@ -2564,7 +2564,7 @@ macro_rules! int_impl {
`
2564
2564
` without modifying the original"]
`
2565
2565
`pub const fn overflowing_div(self, rhs: Self) -> (Self, bool) {
`
2566
2566
`` // Using &
helps LLVM see that it is the same check made in division.
``
2567
``
`-
if unlikely!((self == Self::MIN) & (rhs == -1)) {
`
``
2567
`+
if intrinsics::unlikely((self == Self::MIN) & (rhs == -1)) {
`
2568
2568
`(self, true)
`
2569
2569
`} else {
`
2570
2570
`(self / rhs, false)
`
`@@ -2595,7 +2595,7 @@ macro_rules! int_impl {
`
2595
2595
` without modifying the original"]
`
2596
2596
`pub const fn overflowing_div_euclid(self, rhs: Self) -> (Self, bool) {
`
2597
2597
`` // Using &
helps LLVM see that it is the same check made in division.
``
2598
``
`-
if unlikely!((self == Self::MIN) & (rhs == -1)) {
`
``
2598
`+
if intrinsics::unlikely((self == Self::MIN) & (rhs == -1)) {
`
2599
2599
`(self, true)
`
2600
2600
`} else {
`
2601
2601
`(self.div_euclid(rhs), false)
`
`@@ -2625,7 +2625,7 @@ macro_rules! int_impl {
`
2625
2625
` #[must_use = "this returns the result of the operation, \
`
2626
2626
` without modifying the original"]
`
2627
2627
`pub const fn overflowing_rem(self, rhs: Self) -> (Self, bool) {
`
2628
``
`-
if unlikely!(rhs == -1) {
`
``
2628
`+
if intrinsics::unlikely(rhs == -1) {
`
2629
2629
`(0, self == Self::MIN)
`
2630
2630
`} else {
`
2631
2631
`(self % rhs, false)
`
`@@ -2657,7 +2657,7 @@ macro_rules! int_impl {
`
2657
2657
` #[inline]
`
2658
2658
` #[track_caller]
`
2659
2659
`pub const fn overflowing_rem_euclid(self, rhs: Self) -> (Self, bool) {
`
2660
``
`-
if unlikely!(rhs == -1) {
`
``
2660
`+
if intrinsics::unlikely(rhs == -1) {
`
2661
2661
`(0, self == Self::MIN)
`
2662
2662
`} else {
`
2663
2663
`(self.rem_euclid(rhs), false)
`
`@@ -2686,7 +2686,7 @@ macro_rules! int_impl {
`
2686
2686
` without modifying the original"]
`
2687
2687
` #[allow(unused_attributes)]
`
2688
2688
`pub const fn overflowing_neg(self) -> (Self, bool) {
`
2689
``
`-
if unlikely!(self == Self::MIN) {
`
``
2689
`+
if intrinsics::unlikely(self == Self::MIN) {
`
2690
2690
`(Self::MIN, true)
`
2691
2691
`} else {
`
2692
2692
`(-self, false)
`