Re: shifts & rotations

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

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 thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu