@@ -3234,7 +3234,7 @@ public struct DoubleWidth<Base : FixedWidthInteger> :
3234
3234
} else {
3235
3235
// At this point we know source's bitWidth > Base.bitWidth, or else
3236
3236
// we would've taken the first branch.
3237
- let lowInT = source & T ( ~ Low ( 0 ) )
3237
+ let lowInT = source & T ( ~ 0 as Low )
3238
3238
let highInT = source &>> numericCast ( High . bitWidth)
3239
3239
3240
3240
let low = Low ( lowInT. magnitude)
@@ -3281,7 +3281,7 @@ public struct DoubleWidth<Base : FixedWidthInteger> :
3281
3281
// FIXME: spurious compile error when 'where' clause above is removed:
3282
3282
// error: non-nominal type 'T.RawSignificand' does not support explicit initialization
3283
3283
let fractionPart : Raw = bitPattern &<< Raw ( Raw . bitWidth - offset)
3284
- guard fractionPart == 0 else {
3284
+ guard fractionPart == ( 0 as Raw ) else {
3285
3285
return nil
3286
3286
}
3287
3287
@@ -3374,7 +3374,7 @@ public struct DoubleWidth<Base : FixedWidthInteger> :
3374
3374
let result = DoubleWidth ( extendingOrTruncating: product)
3375
3375
3376
3376
let isNegative = ( self < ( 0 as DoubleWidth ) ) != ( rhs < ( 0 as DoubleWidth ) )
3377
- let didCarry = isNegative ? carry != ~ 0 : carry != 0
3377
+ let didCarry = isNegative ? carry != ~ ( 0 as DoubleWidth ) : carry != ( 0 as DoubleWidth )
3378
3378
let hadPositiveOverflow = !isNegative &&
3379
3379
DoubleWidth . isSigned && product. leadingZeroBitCount == 0
3380
3380
@@ -3406,7 +3406,7 @@ public struct DoubleWidth<Base : FixedWidthInteger> :
3406
3406
let highBit = ~ ( ~ 0 >> 1 ) as Magnitude
3407
3407
for _ in initialOffset..< DoubleWidth . bitWidth {
3408
3408
r <<= 1
3409
- if q & highBit != 0 {
3409
+ if q & highBit != ( 0 as Magnitude ) {
3410
3410
r += 1 as Magnitude
3411
3411
}
3412
3412
q <<= 1
@@ -3431,7 +3431,9 @@ public struct DoubleWidth<Base : FixedWidthInteger> :
3431
3431
3432
3432
public func dividedReportingOverflow( by other: DoubleWidth)
3433
3433
- > ( partialValue: DoubleWidth, overflow: ArithmeticOverflow) {
3434
- if other == 0 || ( DoubleWidth . isSigned && other == - 1 && self == . min) {
3434
+ if other == ( 0 as DoubleWidth ) ||
3435
+ ( DoubleWidth . isSigned && other == ( - 1 as Int ) && self == . min)
3436
+ {
3435
3437
return ( self , . overflow)
3436
3438
}
3437
3439
@@ -3440,7 +3442,9 @@ public struct DoubleWidth<Base : FixedWidthInteger> :
3440
3442
3441
3443
public func remainderReportingOverflow( dividingBy other: DoubleWidth)
3442
3444
- > ( partialValue: DoubleWidth, overflow: ArithmeticOverflow) {
3443
- if other == 0 || ( DoubleWidth . isSigned && other == - 1 && self == . min) {
3445
+ if other == 0 ||
3446
+ ( DoubleWidth . isSigned && other == - 1 && self == . min)
3447
+ {
3444
3448
return ( self , . overflow)
3445
3449
}
3446
3450
@@ -3460,8 +3464,8 @@ public struct DoubleWidth<Base : FixedWidthInteger> :
3460
3464
func sum( _ x: Low , _ y: Low , _ z: Low ) -> ( partial: Low , carry: Low ) {
3461
3465
let ( sum1, overflow1) = x. addingReportingOverflow ( y)
3462
3466
let ( sum2, overflow2) = sum1. addingReportingOverflow ( z)
3463
- let carry : Low = ( overflow1 == . overflow ? Low ( 1 ) : Low ( 0 ) )
3464
- + ( overflow2 == . overflow ? Low ( 1 ) : Low ( 0 ) )
3467
+ let carry : Low = ( overflow1 == . overflow ? 1 : 0 ) +
3468
+ ( overflow2 == . overflow ? 1 : 0 )
3465
3469
return ( sum2, carry)
3466
3470
}
3467
3471
@@ -3535,7 +3539,9 @@ public struct DoubleWidth<Base : FixedWidthInteger> :
3535
3539
}
3536
3540
3537
3541
// Shift is larger than this type's bit width.
3538
- if rhs. _storage. high != 0 || rhs. _storage. low >= DoubleWidth . bitWidth {
3542
+ if rhs. _storage. high != ( 0 as High ) ||
3543
+ rhs. _storage. low >= DoubleWidth . bitWidth
3544
+ {
3539
3545
lhs = lhs < ( 0 as DoubleWidth ) ? ~ 0 : 0
3540
3546
return
3541
3547
}
@@ -3616,13 +3622,13 @@ public struct DoubleWidth<Base : FixedWidthInteger> :
3616
3622
}
3617
3623
3618
3624
public var leadingZeroBitCount: Int {
3619
- return high == 0
3625
+ return high == ( 0 as High )
3620
3626
? Base . bitWidth + low. leadingZeroBitCount
3621
3627
: high. leadingZeroBitCount
3622
3628
}
3623
3629
3624
3630
public var trailingZeroBitCount: Int {
3625
- return low == 0
3631
+ return low == ( 0 as Low )
3626
3632
? Base . bitWidth + high. trailingZeroBitCount
3627
3633
: low. trailingZeroBitCount
3628
3634
}
0 commit comments