5 ms·
It's more of a language/compiler thing than a hardware one. Hardware support for bit shifting exists on every processor I've ever used. The only real question
by blihp 7y ago
It's more of a language/compiler thing than a hardware one. Hardware support for bit shifting exists on every processor I've ever used. The only real question from a performance standpoint is whether the language you are using will automatically generate optimal code for the x*2 and x/2 cases. Most of the time, it's not worth worrying about: you do it in the clearest way possible (i.e. as a math expression, not a bit shift) and only look at forcing the optimization if you have a performance problem.