Module arithmetic

Source
Expand description

§Arithmetic

This module defines jets that compute arithmetic functions.

Functions§

add_8
Add two integers and return the carry.
add_16
Add two integers and return the carry.
add_32
Add two integers and return the carry.
add_64
Add two integers and return the carry.
decrement_8
Decrement an integer by one and return the borrow bit.
decrement_16
Decrement an integer by one and return the borrow bit.
decrement_32
Decrement an integer by one and return the borrow bit.
decrement_64
Decrement an integer by one and return the borrow bit.
div_mod_8
Divide the first integer by the second integer, and return the remainder.
div_mod_16
Divide the first integer by the second integer, and return the remainder.
div_mod_32
Divide the first integer by the second integer, and return the remainder.
div_mod_64
Divide the first integer by the second integer, and return the remainder.
div_mod_128_64
Divide the 128-bit integer a by the 64-bit integer b. Return a tuple of the quotient q and the remainer r.
divide_8
Divide the first integer by the second integer.
divide_16
Divide the first integer by the second integer.
divide_32
Divide the first integer by the second integer.
divide_64
Divide the first integer by the second integer.
divides_8
Check if the first integer is divisible by the second integer.
divides_16
Check if the first integer is divisible by the second integer.
divides_32
Check if the first integer is divisible by the second integer.
divides_64
Check if the first integer is divisible by the second integer.
full_add_8
Add two integers. Take a carry-in and return a carry-out.
full_add_16
Add two integers. Take a carry-in and return a carry-out.
full_add_32
Add two integers. Take a carry-in and return a carry-out.
full_add_64
Add two integers. Take a carry-in and return a carry-out.
full_decrement_8
Decrement an integer by one. Take a borrow-in and return a borrow-out.
full_decrement_16
Decrement an integer by one. Take a borrow-in and return a borrow-out.
full_decrement_32
Decrement an integer by one. Take a borrow-in and return a borrow-out.
full_decrement_64
Decrement an integer by one. Take a borrow-in and return a borrow-out.
full_increment_8
Increment an integer by one. Take a carry-in and return a carry-out.
full_increment_16
Increment an integer by one. Take a carry-in and return a carry-out.
full_increment_32
Increment an integer by one. Take a carry-in and return a carry-out.
full_increment_64
Increment an integer by one. Take a carry-in and return a carry-out.
full_multiply_8
Helper for multiplying integers. Take the product of the first pair of integers and add the sum of the second pair.
full_multiply_16
Helper for multiplying integers. Take the product of the first pair of integers and add the sum of the second pair.
full_multiply_32
Helper for multiplying integers. Take the product of the first pair of integers and add the sum of the second pair.
full_multiply_64
Helper for multiplying integers. Take the product of the first pair of integers and add the sum of the second pair.
full_subtract_8
Subtract the second integer from the first integer. Take a borrow-in and return a borrow-out.
full_subtract_16
Subtract the second integer from the first integer. Take a borrow-in and return a borrow-out.
full_subtract_32
Subtract the second integer from the first integer. Take a borrow-in and return a borrow-out.
full_subtract_64
Subtract the second integer from the first integer. Take a borrow-in and return a borrow-out.
increment_8
Increment an integer by one and return the carry.
increment_16
Increment an integer by one and return the carry.
increment_32
Increment an integer by one and return the carry.
increment_64
Increment an integer by one and return the carry.
is_one_8
Check if an integer is one.
is_one_16
Check if an integer is one.
is_one_32
Check if an integer is one.
is_one_64
Check if an integer is one.
is_zero_8
Check if an integer is zero.
is_zero_16
Check if an integer is zero.
is_zero_32
Check if an integer is zero.
is_zero_64
Check if an integer is zero.
le_8
Check if an integer is less than or equal to another integer.
le_16
Check if an integer is less than or equal to another integer.
le_32
Check if an integer is less than or equal to another integer.
le_64
Check if an integer is less than or equal to another integer.
lt_8
Check if an integer is less than another integer.
lt_16
Check if an integer is less than another integer.
lt_32
Check if an integer is less than another integer.
lt_64
Check if an integer is less than another integer.
max_8
Return the bigger of two integers.
max_16
Return the bigger of two integers.
max_32
Return the bigger of two integers.
max_64
Return the bigger of two integers.
median_8
Return the median of three integers.
median_16
Return the median of three integers.
median_32
Return the median of three integers.
median_64
Return the median of three integers.
min_8
Return the smaller of two integers.
min_16
Return the smaller of two integers.
min_32
Return the smaller of two integers.
min_64
Return the smaller of two integers.
modulo_8
Compute the remainder after dividing both integers.
modulo_16
Compute the remainder after dividing both integers.
modulo_32
Compute the remainder after dividing both integers.
modulo_64
Compute the remainder after dividing both integers.
multiply_8
Multiply two integers. The output is a 16-bit integer.
multiply_16
Multiply two integers. The output is a 32-bit integer.
multiply_32
Multiply two integers. The output is a 64-bit integer.
multiply_64
Multiply two integers. The output is a 128-bit integer.
negate_8
Negate the integer (modulo 2⁸) and return the borrow bit.
negate_16
Negate the integer (modulo 2¹⁶) and return the borrow bit.
negate_32
Negate the integer (modulo 2³²) and return the borrow bit.
negate_64
Negate the integer (modulo 2⁶⁴) and return the borrow bit.
one_8
Return 1 as an 8-bit integer.
one_16
Return 1 as a 16-bit integer.
one_32
Return 1 as a 32-bit integer.
one_64
Return 1 as a 64-bit integer.
subtract_8
Subtract the second integer from the first integer, and return the borrow bit.
subtract_16
Subtract the second integer from the first integer, and return the borrow bit.
subtract_32
Subtract the second integer from the first integer, and return the borrow bit.
subtract_64
Subtract the second integer from the first integer, and return the borrow bit.