"i want a faster way to divide when my numbers are powers of 2":
Code:
int a = x / (power of 2) // is equiv to
int a = x >> sqroot(power of 2)
//so:
int a = 10 / 4;
// becomes
a = 10 >> 2;
int b = 5412 / 16
// becomes
b = 54112 >> 4
same goes for multiplying except use "<<".
the ">>" is a faster operation than "/" (in c++ at least)
"i want a faster way to get the 'mod' of a number when it is a power of 2":
Code:
int a = x % (power of 2)
//becomes
a = x & (power of 2) - 1
int a = 56 % 8
// becomes
a = 56 & 7
// "&" is a faster operation than "%"