How do computers find modulus?
Is there some cool algorithm with bit wise operations? Often, the modulus and divide operations on a processor are the same thing. For instance, refer to http://jsimlo.sk/docs/cpu/index.php/div.html . This is the implementation of the divide instruction on Intel processors. Most of the time, modulus is just computed by dividing the two numbers. The quotient is stored in one register, and the remainder is stored in the other register. You would go after the remainder. If the divisor is known in advance (e.g. for code produced by a C compiler, this is a constant known at compile time) then