1. shifts & rotations

Robert,

I believe multiplies as well as floored divides by 2 are optimized. Since we
do not have fast, native shifts in Euphoria, are multiplies and divides by
integral powers of 2 similarly optimized?
If not, why not?

Thanks. jiri

new topic     » topic index » view message » categorize

2. Re: shifts & rotations

I seem to recall that they are.  I believe that RC said so himself self
when he introduced those optimizations a long time ago.

        Lucius L. Hilley III - Unkmar

----- Original Message ----- 
From: "jiri babor" <jbabor at paradise.net.nz>
To: <EUforum at topica.com>
Subject: shifts & rotations


>
>
> Robert,
>
> I believe multiplies as well as floored divides by 2 are optimized. Since
we
> do not have fast, native shifts in Euphoria, are multiplies and divides by
> integral powers of 2 similarly optimized?
> If not, why not?
>
> Thanks. jiri
>
>
>
> TOPICA - Start your own email discussion group. FREE!
>
>

new topic     » goto parent     » topic index » view message » categorize

3. Re: shifts & rotations

jiri babor wrote:
> I believe multiplies as well as floored divides by 2 are optimized.

Yes.

> Since we
> do not have fast, native shifts in Euphoria, are multiplies and divides by
> integral powers of 2 similarly optimized?

Only 2. Not 4, 8, 16, ...

> If not, why not?

- there's already complicated code to determine if
   an integer*integer multiply might exceed 31 bits
   (and have to be converted to floating-point).
   I'm reluctant to add more special cases.

- C shifts are not completely portable across all machines

- In the Pentium 4, shifts use more cycles (4) than they
   used to (1), so you don't gain a lot by replacing
   multiplies or divides with shifts.

Regards,
    Rob Craig
    Rapid Deployment Software
    http://www.RapidEuphoria.com

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu