You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current addition and subtraction methods have this structure:
@inlinablepublicmutatingfunc addReportingOverflow(_ other:Self)->Bool{leta:Bool=self.low .addReportingOverflow(other.low )letb:Bool=self.high.addReportingOverflow(other.high)letc:Bool= a && self.high.addReportingOverflow(1asDigit)return b || c // this should be « b != c » (!)}
The problem is that b and c negate each other when signed. See tests below:
Perhaps it's worth noting that b and c cannot be true at the same time if the integer is unsigned for the same reason that max + max + 1 < (high: 2, low: 0).
The current addition and subtraction methods have this structure:
The problem is that
b
andc
negate each other when signed. See tests below:These tests validate the case where
b
appears beforec
and vice versa.The text was updated successfully, but these errors were encountered: