I am currently trying to simulate modulo 10 of a number in a simple version of assembly with limited operations. However I can't really think of an efficient way to get modulo 10 of a high number. What my current and obvious "pseudo algorithm" for calculating modulo is:
e.g 117mod10 = 7
Calculate 117 minus 10 as long as it is positive, then add 10.
So with 117 at some point I would get -3 and then I would stop subtracting with 10 and once add 10 instead. (I know in this example will be a bug with numbers who are actually divisible by 10). So my problem is that with bigger numbers it would take way too long. Therefore I wanted to ask if there is any way to realize something like modulo 10 with these available operations: add, subtract, bitwise and, bitwise xor, bitwise shift left / shift right ?