Some BIT shifting instructions could be a handy addition. In platforms without maths co-processors its a simple and quick way of doing multiplication and division. Its also generally handy for manipulating bit flags in variables.
Not a C++ guy but I think its "a = b >> 2" although I prefer the SHL, SHR, ROR, ROL etc... used by assembly.
Just a thought.
Yes, that's what I want too, see my post a few hours earlier about Little / Big endian :-)
Since GLBasic is using floating point numbers only, shifting is not speed improvement.
What I would write - and what you could do yourself is:
FUNCTION ASL: a, s
RETURN a / POW(2, s)
ENDFUNCTION
FUNCTION ASR: a, s
RETURN a * POW(2, s)
ENDFUNCTION
Instead of the POW you propably wand an inline with an integer shift... You'd have to check which one is faster.
Thats better.
FUNCTION ASL: a, s
RETURN a * POW(2, s)
ENDFUNCTION
FUNCTION ASR: a, s
RETURN a / POW(2, s)
ENDFUNCTION
I would like instructions like bitshift and bitrotate left and right just for completeness of the language. I know I would use them and I'm sure others want them too. I don't care if it's fast or not, they are usefull in other areas too.
Rotate is moving bits to the right and when they go out the right side they pop up on the left side again, shift is just moving them out the right side and replacing the new bits with zeroes from the left.
FUNCTION ASL: a% b%
INLINE
a << = b;
ENDINLINE
RETURN a
ENDFUNCTION
I think it would be great to add the commands to the base language for completeness too.