Quote:
Originally Posted by Sane
It's generally not used to do math, because the fact is the difference in speed is pretty much negligible.
...
The behaviour of each program is identical, except the first shifts and the second multiplies. They both do a billion shifts or a billion multiplications in the same amount of time.
This is because they are both constant time operations, and most modern compilers will do optimizations under the hood that make these differences negligible.
|
Source? I thought (at least in MIPS, we didn't cover x86 specifics at my school) that multiplication and division are not constant time operations, and required multiple assembly instructions to perform the operation and fetch the results.