@@ -1281,7 +1281,7 @@ fileprivate func _backend_256bit(
1281
1281
let powerOfTenExponent = intervalContainingPowerOf10_Binary128 ( p: - base10Exponent,
1282
1282
lower: & powerOfTenRoundedDown,
1283
1283
upper: & powerOfTenRoundedUp)
1284
- let extraBits = binaryExponent + powerOfTenExponent
1284
+ let extraBits = binaryExponent & + powerOfTenExponent
1285
1285
1286
1286
// Step 5: Scale the interval (with rounding)
1287
1287
let integerBits = 14
@@ -1292,30 +1292,30 @@ fileprivate func _backend_256bit(
1292
1292
// Narrow the interval (odd significand)
1293
1293
u = powerOfTenRoundedDown
1294
1294
u. multiplyRoundingDown ( by: upperMidpointExact)
1295
- u. shiftRightRoundingDown ( by: integerBits - extraBits)
1295
+ u. shiftRightRoundingDown ( by: integerBits & - extraBits)
1296
1296
1297
1297
l = powerOfTenRoundedUp
1298
1298
l. multiplyRoundingUp ( by: lowerMidpointExact)
1299
- l. shiftRightRoundingUp ( by: integerBits - extraBits)
1299
+ l. shiftRightRoundingUp ( by: integerBits & - extraBits)
1300
1300
} else {
1301
1301
// Widen the interval (even significand)
1302
1302
u = powerOfTenRoundedUp
1303
1303
u. multiplyRoundingUp ( by: upperMidpointExact)
1304
- u. shiftRightRoundingUp ( by: integerBits - extraBits)
1304
+ u. shiftRightRoundingUp ( by: integerBits & - extraBits)
1305
1305
1306
1306
l = powerOfTenRoundedDown
1307
1307
l. multiplyRoundingDown ( by: lowerMidpointExact)
1308
- l. shiftRightRoundingDown ( by: integerBits - extraBits)
1308
+ l. shiftRightRoundingDown ( by: integerBits & - extraBits)
1309
1309
}
1310
1310
1311
1311
// Step 6: Align first digit, adjust exponent
1312
1312
while u. high. _high < ( UInt64 ( 1 ) << high64FractionBits) {
1313
- base10Exponent -= 1
1313
+ base10Exponent & -= 1
1314
1314
l. multiply ( by: UInt32 ( 10 ) )
1315
1315
u. multiply ( by: UInt32 ( 10 ) )
1316
1316
}
1317
1317
var t = u
1318
- var delta = u - l
1318
+ var delta = u & - l
1319
1319
1320
1320
// Step 7: Generate digits
1321
1321
@@ -1355,7 +1355,7 @@ fileprivate func _backend_256bit(
1355
1355
toUncheckedByteOffset: nextDigit,
1356
1356
as: UInt16 . self)
1357
1357
unsafe buffer. storeBytes ( of: asciiDigitTable [ Int ( bitPattern: d34) ] ,
1358
- toUncheckedByteOffset: nextDigit + 2 ,
1358
+ toUncheckedByteOffset: nextDigit & + 2 ,
1359
1359
as: UInt16 . self)
1360
1360
nextDigit &+= 4
1361
1361
t = t0
@@ -1370,8 +1370,8 @@ fileprivate func _backend_256bit(
1370
1370
delta. multiply ( by: UInt32 ( 10 ) )
1371
1371
t. multiply ( by: UInt32 ( 10 ) )
1372
1372
let digit = UInt8 ( truncatingIfNeeded: t. extractIntegerPart ( integerBits) )
1373
- buffer. storeBytes ( of: 0x30 + digit,
1374
- toByteOffset : nextDigit,
1373
+ buffer. storeBytes ( of: 0x30 & + digit,
1374
+ toUncheckedByteOffset : nextDigit,
1375
1375
as: UInt8 . self)
1376
1376
nextDigit &+= 1
1377
1377
}
@@ -1383,17 +1383,17 @@ fileprivate func _backend_256bit(
1383
1383
// 64 bits here.
1384
1384
let deltaHigh64 = delta. high. _high
1385
1385
let tHigh64 = t. high. _high
1386
- if deltaHigh64 >= tHigh64 + ( UInt64 ( 1 ) << high64FractionBits) {
1386
+ if deltaHigh64 >= tHigh64 & + ( UInt64 ( 1 ) << high64FractionBits) {
1387
1387
let skew : UInt64
1388
1388
if isBoundary {
1389
- skew = deltaHigh64 - deltaHigh64 / 3 - tHigh64
1389
+ skew = deltaHigh64 & - deltaHigh64 / 3 & - tHigh64
1390
1390
} else {
1391
- skew = deltaHigh64 / 2 - tHigh64
1391
+ skew = deltaHigh64 / 2 & - tHigh64
1392
1392
}
1393
1393
let one = UInt64 ( 1 ) << high64FractionBits
1394
1394
let fractionMask = one - 1
1395
1395
let oneHalf = one >> 1
1396
- var lastDigit = unsafe buffer. unsafeLoad ( fromUncheckedByteOffset: nextDigit - 1 ,
1396
+ var lastDigit = unsafe buffer. unsafeLoad ( fromUncheckedByteOffset: nextDigit & - 1 ,
1397
1397
as: UInt8 . self)
1398
1398
if ( skew & fractionMask) == oneHalf {
1399
1399
let adjust = skew >> high64FractionBits
@@ -1404,7 +1404,7 @@ fileprivate func _backend_256bit(
1404
1404
lastDigit &-= UInt8 ( truncatingIfNeeded: adjust)
1405
1405
}
1406
1406
buffer. storeBytes ( of: lastDigit,
1407
- toByteOffset: nextDigit - 1 ,
1407
+ toByteOffset: nextDigit & - 1 ,
1408
1408
as: UInt8 . self)
1409
1409
}
1410
1410
@@ -1897,7 +1897,7 @@ fileprivate struct UInt256 {
1897
1897
return UInt ( truncatingIfNeeded: integral)
1898
1898
}
1899
1899
1900
- static func - ( lhs: UInt256 , rhs: UInt256 ) -> UInt256 {
1900
+ static func & - ( lhs: UInt256 , rhs: UInt256 ) -> UInt256 {
1901
1901
var t = UInt128 ( lhs. low. _low) &+ UInt128 ( ~ rhs. low. _low) &+ 1
1902
1902
let newlowlow = t. _low
1903
1903
t = UInt128 ( t. _high) &+ UInt128 ( lhs. low. _high) &+ UInt128 ( ~ rhs. low. _high)
0 commit comments