@@ -991,7 +991,8 @@ pow_impl!(BigUint);
991
991
trait UnsignedAbs {
992
992
type Unsigned ;
993
993
/// A convenience method for getting the absolute value of a signed primitive as unsigned
994
- fn unsigned_abs ( self ) -> Self :: Unsigned ;
994
+ /// See also `unsigned_abs`: https://github.com/rust-lang/rust/issues/74913
995
+ fn uabs ( self ) -> Self :: Unsigned ;
995
996
}
996
997
997
998
macro_rules! impl_unsigned_abs {
@@ -1000,7 +1001,7 @@ macro_rules! impl_unsigned_abs {
1000
1001
type Unsigned = $Unsigned;
1001
1002
1002
1003
#[ inline]
1003
- fn unsigned_abs ( self ) -> $Unsigned {
1004
+ fn uabs ( self ) -> $Unsigned {
1004
1005
self . wrapping_abs( ) as $Unsigned
1005
1006
}
1006
1007
}
@@ -1177,7 +1178,7 @@ impl Add<i32> for BigInt {
1177
1178
if other >= 0 {
1178
1179
self + other as u32
1179
1180
} else {
1180
- self - other. unsigned_abs ( )
1181
+ self - other. uabs ( )
1181
1182
}
1182
1183
}
1183
1184
}
@@ -1187,7 +1188,7 @@ impl AddAssign<i32> for BigInt {
1187
1188
if other >= 0 {
1188
1189
* self += other as u32 ;
1189
1190
} else {
1190
- * self -= other. unsigned_abs ( ) ;
1191
+ * self -= other. uabs ( ) ;
1191
1192
}
1192
1193
}
1193
1194
}
@@ -1200,7 +1201,7 @@ impl Add<i64> for BigInt {
1200
1201
if other >= 0 {
1201
1202
self + other as u64
1202
1203
} else {
1203
- self - other. unsigned_abs ( )
1204
+ self - other. uabs ( )
1204
1205
}
1205
1206
}
1206
1207
}
@@ -1210,7 +1211,7 @@ impl AddAssign<i64> for BigInt {
1210
1211
if other >= 0 {
1211
1212
* self += other as u64 ;
1212
1213
} else {
1213
- * self -= other. unsigned_abs ( ) ;
1214
+ * self -= other. uabs ( ) ;
1214
1215
}
1215
1216
}
1216
1217
}
@@ -1223,7 +1224,7 @@ impl Add<i128> for BigInt {
1223
1224
if other >= 0 {
1224
1225
self + other as u128
1225
1226
} else {
1226
- self - other. unsigned_abs ( )
1227
+ self - other. uabs ( )
1227
1228
}
1228
1229
}
1229
1230
}
@@ -1233,7 +1234,7 @@ impl AddAssign<i128> for BigInt {
1233
1234
if other >= 0 {
1234
1235
* self += other as u128 ;
1235
1236
} else {
1236
- * self -= other. unsigned_abs ( ) ;
1237
+ * self -= other. uabs ( ) ;
1237
1238
}
1238
1239
}
1239
1240
}
@@ -1429,7 +1430,7 @@ impl Sub<i32> for BigInt {
1429
1430
if other >= 0 {
1430
1431
self - other as u32
1431
1432
} else {
1432
- self + other. unsigned_abs ( )
1433
+ self + other. uabs ( )
1433
1434
}
1434
1435
}
1435
1436
}
@@ -1439,7 +1440,7 @@ impl SubAssign<i32> for BigInt {
1439
1440
if other >= 0 {
1440
1441
* self -= other as u32 ;
1441
1442
} else {
1442
- * self += other. unsigned_abs ( ) ;
1443
+ * self += other. uabs ( ) ;
1443
1444
}
1444
1445
}
1445
1446
}
@@ -1452,7 +1453,7 @@ impl Sub<BigInt> for i32 {
1452
1453
if self >= 0 {
1453
1454
self as u32 - other
1454
1455
} else {
1455
- -other - self . unsigned_abs ( )
1456
+ -other - self . uabs ( )
1456
1457
}
1457
1458
}
1458
1459
}
@@ -1465,7 +1466,7 @@ impl Sub<i64> for BigInt {
1465
1466
if other >= 0 {
1466
1467
self - other as u64
1467
1468
} else {
1468
- self + other. unsigned_abs ( )
1469
+ self + other. uabs ( )
1469
1470
}
1470
1471
}
1471
1472
}
@@ -1475,7 +1476,7 @@ impl SubAssign<i64> for BigInt {
1475
1476
if other >= 0 {
1476
1477
* self -= other as u64 ;
1477
1478
} else {
1478
- * self += other. unsigned_abs ( ) ;
1479
+ * self += other. uabs ( ) ;
1479
1480
}
1480
1481
}
1481
1482
}
@@ -1488,7 +1489,7 @@ impl Sub<BigInt> for i64 {
1488
1489
if self >= 0 {
1489
1490
self as u64 - other
1490
1491
} else {
1491
- -other - self . unsigned_abs ( )
1492
+ -other - self . uabs ( )
1492
1493
}
1493
1494
}
1494
1495
}
@@ -1501,7 +1502,7 @@ impl Sub<i128> for BigInt {
1501
1502
if other >= 0 {
1502
1503
self - other as u128
1503
1504
} else {
1504
- self + other. unsigned_abs ( )
1505
+ self + other. uabs ( )
1505
1506
}
1506
1507
}
1507
1508
}
@@ -1512,7 +1513,7 @@ impl SubAssign<i128> for BigInt {
1512
1513
if other >= 0 {
1513
1514
* self -= other as u128 ;
1514
1515
} else {
1515
- * self += other. unsigned_abs ( ) ;
1516
+ * self += other. uabs ( ) ;
1516
1517
}
1517
1518
}
1518
1519
}
@@ -1525,7 +1526,7 @@ impl Sub<BigInt> for i128 {
1525
1526
if self >= 0 {
1526
1527
self as u128 - other
1527
1528
} else {
1528
- -other - self . unsigned_abs ( )
1529
+ -other - self . uabs ( )
1529
1530
}
1530
1531
}
1531
1532
}
@@ -1624,7 +1625,7 @@ impl Mul<i32> for BigInt {
1624
1625
if other >= 0 {
1625
1626
self * other as u32
1626
1627
} else {
1627
- -( self * other. unsigned_abs ( ) )
1628
+ -( self * other. uabs ( ) )
1628
1629
}
1629
1630
}
1630
1631
}
@@ -1636,7 +1637,7 @@ impl MulAssign<i32> for BigInt {
1636
1637
* self *= other as u32 ;
1637
1638
} else {
1638
1639
self . sign = -self . sign ;
1639
- * self *= other. unsigned_abs ( ) ;
1640
+ * self *= other. uabs ( ) ;
1640
1641
}
1641
1642
}
1642
1643
}
@@ -1649,7 +1650,7 @@ impl Mul<i64> for BigInt {
1649
1650
if other >= 0 {
1650
1651
self * other as u64
1651
1652
} else {
1652
- -( self * other. unsigned_abs ( ) )
1653
+ -( self * other. uabs ( ) )
1653
1654
}
1654
1655
}
1655
1656
}
@@ -1661,7 +1662,7 @@ impl MulAssign<i64> for BigInt {
1661
1662
* self *= other as u64 ;
1662
1663
} else {
1663
1664
self . sign = -self . sign ;
1664
- * self *= other. unsigned_abs ( ) ;
1665
+ * self *= other. uabs ( ) ;
1665
1666
}
1666
1667
}
1667
1668
}
@@ -1674,7 +1675,7 @@ impl Mul<i128> for BigInt {
1674
1675
if other >= 0 {
1675
1676
self * other as u128
1676
1677
} else {
1677
- -( self * other. unsigned_abs ( ) )
1678
+ -( self * other. uabs ( ) )
1678
1679
}
1679
1680
}
1680
1681
}
@@ -1686,7 +1687,7 @@ impl MulAssign<i128> for BigInt {
1686
1687
* self *= other as u128 ;
1687
1688
} else {
1688
1689
self . sign = -self . sign ;
1689
- * self *= other. unsigned_abs ( ) ;
1690
+ * self *= other. uabs ( ) ;
1690
1691
}
1691
1692
}
1692
1693
}
@@ -1813,7 +1814,7 @@ impl Div<i32> for BigInt {
1813
1814
if other >= 0 {
1814
1815
self / other as u32
1815
1816
} else {
1816
- -( self / other. unsigned_abs ( ) )
1817
+ -( self / other. uabs ( ) )
1817
1818
}
1818
1819
}
1819
1820
}
@@ -1825,7 +1826,7 @@ impl DivAssign<i32> for BigInt {
1825
1826
* self /= other as u32 ;
1826
1827
} else {
1827
1828
self . sign = -self . sign ;
1828
- * self /= other. unsigned_abs ( ) ;
1829
+ * self /= other. uabs ( ) ;
1829
1830
}
1830
1831
}
1831
1832
}
@@ -1838,7 +1839,7 @@ impl Div<BigInt> for i32 {
1838
1839
if self >= 0 {
1839
1840
self as u32 / other
1840
1841
} else {
1841
- -( self . unsigned_abs ( ) / other)
1842
+ -( self . uabs ( ) / other)
1842
1843
}
1843
1844
}
1844
1845
}
@@ -1851,7 +1852,7 @@ impl Div<i64> for BigInt {
1851
1852
if other >= 0 {
1852
1853
self / other as u64
1853
1854
} else {
1854
- -( self / other. unsigned_abs ( ) )
1855
+ -( self / other. uabs ( ) )
1855
1856
}
1856
1857
}
1857
1858
}
@@ -1863,7 +1864,7 @@ impl DivAssign<i64> for BigInt {
1863
1864
* self /= other as u64 ;
1864
1865
} else {
1865
1866
self . sign = -self . sign ;
1866
- * self /= other. unsigned_abs ( ) ;
1867
+ * self /= other. uabs ( ) ;
1867
1868
}
1868
1869
}
1869
1870
}
@@ -1876,7 +1877,7 @@ impl Div<BigInt> for i64 {
1876
1877
if self >= 0 {
1877
1878
self as u64 / other
1878
1879
} else {
1879
- -( self . unsigned_abs ( ) / other)
1880
+ -( self . uabs ( ) / other)
1880
1881
}
1881
1882
}
1882
1883
}
@@ -1889,7 +1890,7 @@ impl Div<i128> for BigInt {
1889
1890
if other >= 0 {
1890
1891
self / other as u128
1891
1892
} else {
1892
- -( self / other. unsigned_abs ( ) )
1893
+ -( self / other. uabs ( ) )
1893
1894
}
1894
1895
}
1895
1896
}
@@ -1901,7 +1902,7 @@ impl DivAssign<i128> for BigInt {
1901
1902
* self /= other as u128 ;
1902
1903
} else {
1903
1904
self . sign = -self . sign ;
1904
- * self /= other. unsigned_abs ( ) ;
1905
+ * self /= other. uabs ( ) ;
1905
1906
}
1906
1907
}
1907
1908
}
@@ -1914,7 +1915,7 @@ impl Div<BigInt> for i128 {
1914
1915
if self >= 0 {
1915
1916
self as u128 / other
1916
1917
} else {
1917
- -( self . unsigned_abs ( ) / other)
1918
+ -( self . uabs ( ) / other)
1918
1919
}
1919
1920
}
1920
1921
}
@@ -2047,7 +2048,7 @@ impl Rem<i32> for BigInt {
2047
2048
if other >= 0 {
2048
2049
self % other as u32
2049
2050
} else {
2050
- self % other. unsigned_abs ( )
2051
+ self % other. uabs ( )
2051
2052
}
2052
2053
}
2053
2054
}
@@ -2058,7 +2059,7 @@ impl RemAssign<i32> for BigInt {
2058
2059
if other >= 0 {
2059
2060
* self %= other as u32 ;
2060
2061
} else {
2061
- * self %= other. unsigned_abs ( ) ;
2062
+ * self %= other. uabs ( ) ;
2062
2063
}
2063
2064
}
2064
2065
}
@@ -2071,7 +2072,7 @@ impl Rem<BigInt> for i32 {
2071
2072
if self >= 0 {
2072
2073
self as u32 % other
2073
2074
} else {
2074
- -( self . unsigned_abs ( ) % other)
2075
+ -( self . uabs ( ) % other)
2075
2076
}
2076
2077
}
2077
2078
}
@@ -2084,7 +2085,7 @@ impl Rem<i64> for BigInt {
2084
2085
if other >= 0 {
2085
2086
self % other as u64
2086
2087
} else {
2087
- self % other. unsigned_abs ( )
2088
+ self % other. uabs ( )
2088
2089
}
2089
2090
}
2090
2091
}
@@ -2095,7 +2096,7 @@ impl RemAssign<i64> for BigInt {
2095
2096
if other >= 0 {
2096
2097
* self %= other as u64 ;
2097
2098
} else {
2098
- * self %= other. unsigned_abs ( ) ;
2099
+ * self %= other. uabs ( ) ;
2099
2100
}
2100
2101
}
2101
2102
}
@@ -2108,7 +2109,7 @@ impl Rem<BigInt> for i64 {
2108
2109
if self >= 0 {
2109
2110
self as u64 % other
2110
2111
} else {
2111
- -( self . unsigned_abs ( ) % other)
2112
+ -( self . uabs ( ) % other)
2112
2113
}
2113
2114
}
2114
2115
}
@@ -2121,7 +2122,7 @@ impl Rem<i128> for BigInt {
2121
2122
if other >= 0 {
2122
2123
self % other as u128
2123
2124
} else {
2124
- self % other. unsigned_abs ( )
2125
+ self % other. uabs ( )
2125
2126
}
2126
2127
}
2127
2128
}
@@ -2132,7 +2133,7 @@ impl RemAssign<i128> for BigInt {
2132
2133
if other >= 0 {
2133
2134
* self %= other as u128 ;
2134
2135
} else {
2135
- * self %= other. unsigned_abs ( ) ;
2136
+ * self %= other. uabs ( ) ;
2136
2137
}
2137
2138
}
2138
2139
}
@@ -2145,7 +2146,7 @@ impl Rem<BigInt> for i128 {
2145
2146
if self >= 0 {
2146
2147
self as u128 % other
2147
2148
} else {
2148
- -( self . unsigned_abs ( ) % other)
2149
+ -( self . uabs ( ) % other)
2149
2150
}
2150
2151
}
2151
2152
}
0 commit comments