@@ -84,7 +84,7 @@ public struct Decimal {
84
84
self . __reserved = 0
85
85
}
86
86
87
- public init ( _exponent: Int32 , _length: UInt32 , _isNegative: UInt32 , _isCompact: UInt32 , _reserved: UInt32 , _mantissa: ( UInt16 , UInt16 , UInt16 , UInt16 , UInt16 , UInt16 , UInt16 , UInt16 ) ) {
87
+ public init ( _exponent: Int32 , _length: UInt32 , _isNegative: UInt32 , _isCompact: UInt32 , _reserved: UInt32 , _mantissa: ( UInt16 , UInt16 , UInt16 , UInt16 , UInt16 , UInt16 , UInt16 , UInt16 ) ) {
88
88
self . _mantissa = _mantissa
89
89
self . __exponent = Int8 ( truncatingIfNeeded: _exponent)
90
90
self . __lengthAndFlags = UInt8 ( _length & 0b1111 )
@@ -340,56 +340,57 @@ extension Decimal : SignedNumeric {
340
340
fatalError ( )
341
341
}
342
342
343
- public static func += ( _ lhs: inout Decimal , _ rhs: Decimal ) {
344
- var leftOp = lhs
345
- var rightOp = rhs
346
- _ = NSDecimalAdd ( & lhs, & leftOp, & rightOp, . plain)
343
+ public static func += ( lhs: inout Decimal , rhs: Decimal ) {
344
+ var rhs = rhs
345
+ _ = withUnsafeMutablePointer ( to: & lhs) {
346
+ NSDecimalAdd ( $0, $0, & rhs, . plain)
347
+ }
347
348
}
348
349
349
- public static func -= ( _ lhs: inout Decimal , _ rhs: Decimal ) {
350
- var leftOp = lhs
351
- var rightOp = rhs
352
- _ = NSDecimalSubtract ( & lhs, & leftOp, & rightOp, . plain)
350
+ public static func -= ( lhs: inout Decimal , rhs: Decimal ) {
351
+ var rhs = rhs
352
+ _ = withUnsafeMutablePointer ( to: & lhs) {
353
+ NSDecimalSubtract ( $0, $0, & rhs, . plain)
354
+ }
353
355
}
354
356
355
- public static func *= ( _ lhs: inout Decimal , _ rhs: Decimal ) {
356
- var leftOp = lhs
357
- var rightOp = rhs
358
- _ = NSDecimalMultiply ( & lhs, & leftOp, & rightOp, . plain)
357
+ public static func *= ( lhs: inout Decimal , rhs: Decimal ) {
358
+ var rhs = rhs
359
+ _ = withUnsafeMutablePointer ( to: & lhs) {
360
+ NSDecimalMultiply ( $0, $0, & rhs, . plain)
361
+ }
359
362
}
360
363
361
- public static func /= ( _ lhs: inout Decimal , _ rhs: Decimal ) {
362
- var leftOp = lhs
363
- var rightOp = rhs
364
- _ = NSDecimalDivide ( & lhs, & leftOp, & rightOp, . plain)
364
+ public static func /= ( lhs: inout Decimal , rhs: Decimal ) {
365
+ var rhs = rhs
366
+ _ = withUnsafeMutablePointer ( to: & lhs) {
367
+ NSDecimalDivide ( $0, $0, & rhs, . plain)
368
+ }
365
369
}
366
370
367
371
public static func + ( lhs: Decimal , rhs: Decimal ) -> Decimal {
368
372
var answer = lhs
369
373
answer += rhs
370
- return answer;
374
+ return answer
371
375
}
372
376
373
377
public static func - ( lhs: Decimal , rhs: Decimal ) -> Decimal {
374
378
var answer = lhs
375
379
answer -= rhs
376
- return answer;
377
- }
378
-
379
- public static func / ( lhs: Decimal , rhs: Decimal ) -> Decimal {
380
- var answer = lhs
381
- answer /= rhs
382
- return answer;
380
+ return answer
383
381
}
384
382
385
383
public static func * ( lhs: Decimal , rhs: Decimal ) -> Decimal {
386
384
var answer = lhs
387
385
answer *= rhs
388
- return answer;
386
+ return answer
389
387
}
390
388
391
- @available ( * , unavailable, message: " Decimal does not yet fully adopt FloatingPoint. " )
392
- public mutating func formTruncatingRemainder( dividingBy other: Decimal ) { fatalError ( " Decimal does not yet fully adopt FloatingPoint " ) }
389
+ public static func / ( lhs: Decimal , rhs: Decimal ) -> Decimal {
390
+ var answer = lhs
391
+ answer /= rhs
392
+ return answer
393
+ }
393
394
394
395
public mutating func negate( ) {
395
396
guard _length != 0 else { return }
@@ -625,6 +626,9 @@ extension Decimal {
625
626
public var isSignaling : Bool {
626
627
return false
627
628
}
629
+
630
+ @available ( * , unavailable, message: " Decimal does not yet fully adopt FloatingPoint. " )
631
+ public mutating func formTruncatingRemainder( dividingBy other: Decimal ) { fatalError ( " Decimal does not yet fully adopt FloatingPoint " ) }
628
632
}
629
633
630
634
extension Decimal : CustomStringConvertible {
0 commit comments