c++ - How to divide integer by a constant integer with right shift operators? -
this question has answer here:
i'm interested how this, because found out can integer multiplication easily, using left shift operators:
x * 25 = (x << 4) + (x << 3) + x
where sum of base 2 powers equals 25: 2^4+2^3+2^0 = 25
how x / 25
work out right shifts?
edit: i'm not going replace division , multiplication in programs these shift operators in hope of speed boost ;)
Comments
Post a Comment