Is there a quicker way to /4

Blitz3D Forums/Blitz3D Programming/Is there a quicker way to /4

Is there a bit shift operator?

I have some like x/4 every time round my loop, is there a quicker way of achiving this?

i.e x>>2 + x>>2

Thanks

Bit shift operators:
Shr, Shl

example:
x Shr 2
integer division by 4

But who knows -- maybe the compiler converts your x/4 to x Shr 2 during compile anyway...

Doubt, at least it makes a different exe file.

If its a float you can multiply by 0.25. In my experience most of these optimisations are a waste of time and destroy readability.

But who knows -- maybe the compiler converts your x/4 to x Shr 2 during compile anyway...
It does.
In my experience most of these optimisations are a waste of time and destroy readability.
They are. "Simple" maths are not the appropriate place to optimize anymore.

Yup. The place to optimise is the whole approach to the problem.