Bit Shifting

Blitz3D Forums/Blitz3D Programming/Bit Shifting

N(Posted 2004) [#1]
I'm curious about the speed of bit-shifts in Blitz3D (via Shl and Shr), is Blitz3D known to have a great deal of trouble handling them?

Just a minor concern of mine, since I tend to use the aforementioned instructions quite a bit.


Bot Builder(Posted 2004) [#2]
Maybe a bit overdoing but....



Huh. I get around 2000 for each of them. Maybe blitz optimises the multiplacations maybe? the odd thing is divide is faster than multiplication for me....


N(Posted 2004) [#3]
In Debug mode all multiplication operations range from 2800 to 3000, and all division operations range from 2500 to exactly 3000.

Without Debug mode, it's under 30 for all of them.


big10p(Posted 2004) [#4]
Bit shift operations should be extremely fast in any language as they map directly to CPU operations.


jfk EO-11110(Posted 2004) [#5]
AFAIK the shift commands are no longer that much faster than say 32 Bit division because the FPU is heavily optimized and embeded in the CPU these days. And of course a language like Blitz will not map the shift commands directly to the CPU OPS because it has to catch parameter Errors. In the end it's mostly the Error handling that eats the power, the command itself is rather insignificantly timeconsuming.