Re: shifts & rotations
- Posted by Robert Craig <rds at RapidEuphoria.com> Dec 31, 2003
- 423 views
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