Extension and implementation of the mod without mod algorithm to efficiently compute the modulus of a number in hardware