Skip to content

Commit

Permalink
Merge pull request #805 from ikesyo/nsdecimal-address-mixedtype-warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
swift-ci committed Jan 19, 2017
2 parents 4181c3e + 8fd33d4 commit 6c2afef
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Foundation/NSDecimal.swift
Expand Up @@ -1035,10 +1035,10 @@ public func NSDecimalNormalize(_ a: UnsafeMutablePointer<Decimal>, _ b: UnsafeMu
//
// Divide bb by this value
//
_ = integerMultiplyByPowerOf10(&result, bb.pointee, maxpow10 - diffexp)
_ = integerMultiplyByPowerOf10(&result, bb.pointee, Int(maxpow10 - diffexp))

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

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

0 comments on commit 6c2afef

Please sign in to comment.