File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -257,7 +257,7 @@ extension _${U}Int128: FixedWidthInteger {
257
257
by rhs: Self
258
258
) -> (partialValue: Self, overflow: Bool) {
259
259
% if signed:
260
- let isNegative = (self._isNegative != rhs._isNegative)
260
+ let isNegative = (self._isNegative != rhs._isNegative && self != .zero && rhs != .zero )
261
261
let (p, overflow) = self.magnitude.multipliedReportingOverflow(
262
262
by: rhs.magnitude)
263
263
let r = _Int128(bitPattern: isNegative ? p._twosComplement : p)
@@ -281,7 +281,7 @@ extension _${U}Int128: FixedWidthInteger {
281
281
by other: UInt64
282
282
) -> (partialValue: Self, overflow: Bool) {
283
283
% if signed:
284
- let isNegative = self._isNegative
284
+ let isNegative = self._isNegative && self != .zero && other != .zero
285
285
let (p, overflow) = self.magnitude.multipliedReportingOverflow(by: other)
286
286
let r = _Int128(bitPattern: isNegative ? p._twosComplement : p)
287
287
return (r, overflow || (isNegative != r._isNegative))
You can’t perform that action at this time.
0 commit comments