3 ms·
With a DSP core it often gets even better, the bit shift might be free. Say you have the instruction ACC = ACC + P << PM, that could compile to a single instruc
by NwtnsMthd 5y ago
With a DSP core it often gets even better, the bit shift might be free. Say you have the instruction ACC = ACC + P << PM, that could compile to a single instruction, if you're not writing assembly directly.
Additionally if you're ever working directly with hardware, writing drivers, or firmware, bit-shift operations are often the best (and most common) way to get stuff done.
- rasz 5y agoSame on first ARM chips http://www.csbio.unc.edu/mcmillan/Comp411F18/Lecture07.pdf http://www.csbio.unc.edu/mcmillan/Comp411F18/Lecture07.pdf
- BulgarianIdiot 5y agoI wouldn't call it better because CPUs have a similar "sum and multiply" instruction, and GPUs are pretty much made of such units. The problem with bitshifting is that it's just a special case of multiplication and division. So if you want your hardware utilized, you don't scale bitshifts, that'd be largely useless. You scale multiplication and division, and this is what modern hardware does. Bitshifting is very simple in terms of hardware, but scale beats simplicity.