bit.mod

Bitwise 'modulus' (remainder after integer divide)

Prototype

n = bit.mod (a, b)

Description

This takes two arguments. Both are converted to signed 'long long' (64-bit integers). The result is modulus - the remainder after doing an integer divide of the first argument by the second argument.
eg.

print (bit.mod (17, 4))  --> 1

Lua functions

Topics