Skip to content

Wrapping unsigned binary integer subtraction #110

Description

@oscbyspro

NBKUnsignedInteger already requires recoverable unsigned subtraction (#34):

func subtractingReportingOverflow(_ other: Self) -> PVO<Self>
mutating func subtractReportingOverflow(_ other: Self) -> Bool

@_disfavoredOverload func subtractingReportingOverflow(_ other: Digit) -> PVO<Self>
@_disfavoredOverload mutating func subtractReportingOverflow(_ other: Digit) -> Bool

These have well-defined 2's complement semantics. How about conveniences?

static func &- (lhs:       Self, rhs: Self) -> Self
static func &-=(lhs: inout Self, rhs: Self)

@_disfavoredOverload static func &- (lhs:       Self, rhs: Digit) -> Self 
@_disfavoredOverload static func &-=(lhs: inout Self, rhs: Digit)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    additionoh, so shiny!maybeto do, or not to do?

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions