Skip to content

Commit

Permalink
add addc, subc and mulc method to the Integer trait
Browse files Browse the repository at this point in the history
  • Loading branch information
mfelsche committed Apr 13, 2018
1 parent 92fb7bf commit 09fce80
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/builtin/real.pony
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,18 @@ trait val Integer[A: Integer[A] val] is Real[A]
"""
-~this

fun addc(y: A): (A, Bool)
"""
Add `y` to this integer and return the result and a flag indicating overflow.
"""
fun subc(y: A): (A, Bool)
"""
Subtract `y` from this integer and return the result and a flag indicating overflow.
"""
fun mulc(y: A): (A, Bool)
"""
Multiply `y` with this integer and return the result and a flag indicating overflow.
"""
fun op_and(y: A): A => this and y
fun op_or(y: A): A => this or y
fun op_xor(y: A): A => this xor y
Expand Down

0 comments on commit 09fce80

Please sign in to comment.