Skip to content

Commit 6c2afef

Browse files
authored
Merge pull request #805 from ikesyo/nsdecimal-address-mixedtype-warnings
2 parents 4181c3e + 8fd33d4 commit 6c2afef

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Foundation/NSDecimal.swift

+5-5
Original file line numberDiff line numberDiff line change
@@ -1035,10 +1035,10 @@ public func NSDecimalNormalize(_ a: UnsafeMutablePointer<Decimal>, _ b: UnsafeMu
10351035
//
10361036
// Divide bb by this value
10371037
//
1038-
_ = integerMultiplyByPowerOf10(&result, bb.pointee, maxpow10 - diffexp)
1038+
_ = integerMultiplyByPowerOf10(&result, bb.pointee, Int(maxpow10 - diffexp))
10391039

10401040
bb.pointee.copyMantissa(from: result)
1041-
bb.pointee._exponent -= maxpow10 - diffexp;
1041+
bb.pointee._exponent -= Int32(maxpow10 - diffexp);
10421042

10431043
//
10441044
// If bb > 0 multiply aa by the same value
@@ -1336,7 +1336,7 @@ public func NSDecimalDivide(_ result: UnsafeMutablePointer<Decimal>, _ leftOpera
13361336
* accurate result later. I chose 19 arbitrarily
13371337
* as half of the magic 38, so that normalization
13381338
* doesn't always occur. */
1339-
if (19 <= a._exponent - b._exponent) {
1339+
if (19 <= Int(a._exponent - b._exponent)) {
13401340
_ = NSDecimalNormalize(&a, &b, roundingMode);
13411341
/* We ignore the small loss of precision this may
13421342
* induce in the individual operands. */
@@ -1615,7 +1615,7 @@ extension Decimal {
16151615
}
16161616
fileprivate mutating func round(scale:Int, roundingMode:RoundingMode) {
16171617
// scale is the number of digits after the decimal point
1618-
var s = scale + _exponent
1618+
var s = Int32(scale) + _exponent
16191619
if s == NSDecimalNoScale || s >= 0 {
16201620
return
16211621
}
@@ -2025,7 +2025,7 @@ extension Scanner {
20252025
if numeral == -1 {
20262026
break
20272027
}
2028-
exponent = 10 * exponent + numeral
2028+
exponent = 10 * exponent + Int32(numeral)
20292029
guard exponent <= 2*Int32(Int8.max) else {
20302030
return Decimal.nan
20312031
}

0 commit comments

Comments
 (0)