3 ms·
The same technique for dividing by 9 in base 10, also works for dividing by 255 in base 256, so you can quickly calculate N % 255 by adding the bytes of N toget
by finnw 15y ago
The same technique for dividing by 9 in base 10, also works for dividing by 255 in base 256, so you can quickly calculate N % 255 by adding the bytes of N together.
Useful for algorithms like this: http://stackoverflow.com/q/295579/12048 http://stackoverflow.com/q/295579/12048