bitwise shifts gone?
Mark Wieder
ahsoftware at sonic.net
Sat Jun 30 11:00:31 EDT 2018
On 06/30/2018 03:50 AM, hh via use-livecode wrote:
> Mark,
>
> obviously you ask relating to Bob's IPv4 sort problem.
A perceptive observation, as always.
>
> But when optimising (for speed) the connected formula
>
> (1) a + b * 2^8 + c * 2^16 + d * 2^32
>
> using the constants is slightly faster:
>
> (2) a + b * 256 + c * 65536 + d * 16777216
Would bitOr operators increase the speed over additions?
>
> Why is the engine not handling the internal bitshifts easier with (1)?
Indeed. I'm not too upset about the loss of the bitshift operators other
than the lack of backward compatibility, but I'm surprised by their
demise. In terms of minimal use of microprocessor cycles I'd expect that
the fastest would be
a || (b << 8) || (c << 16) || (d << 32)
--
Mark Wieder
ahsoftware at gmail.com
More information about the use-livecode
mailing list