c++ - How to divide integer by a constant integer with right shift operators? -


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

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -