Bit Shift Left and Bit Shift Right

new topic     » topic index » view thread      » older message » newer message

In the early days of Euphoria I was complaining about Bit shifting as
much as you are now.  Euphoria now optimizes some math computations
into bit shifting...

integer i
i = rand(324)-- just some random number
i *= 2 -- Shift Left
i *= 4 -- Shift left twice.
i = floor(i/2) -- Shift right
i = floor(i/4) -- Shift right twice?

PS: if that doesn't actually become a Shift right it is still
computationally equivalent.  Don't sweat it.  Euphoria is pretty fast
for an interpreted language.

        Lucius L. Hilley III
        lhilley at cdc.net
+----------+--------------+--------------+
| Hollow   | ICQ: 9638898 | AIM: LLHIII  |
|  Horse   +--------------+--------------+
| Software | http://www.cdc.net/~lhilley |
+----------+-----------------------------+

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu