Mail Archives: djgpp/1998/06/29/13:37:42
>SHL is MUCH faster than multiple !
In almost any language, this is correct. It's faster to shift bits along a
byte than it is to multply, carry, check for overflows etc. It's much faster
to divide by using >> or SHR.
I have noticed, though, that the PC only has one type of shifting command.
On the Motorola, there's ASL, ASR (arethmetic), LSL and LSR (logical), along
with the rolling commands ROL and ROR and all the shifting commands that
change different bits depending on the values entered into them. Are there
any of these on the PC?
And while we're on the subject, I am assuming that << and >> are arethmetic
shifting operands. Is there a similar command to do logical shifting in
C/C++?
James Arthur
jaa AT arfa DOT clara DOT net
- Raw text -