1. Re: Encrypting (and bit-shifting)
- Posted by Pete Eberlein <xseal at HARBORSIDE.COM> Jul 09, 1997
- 611 views
- Last edited Jul 10, 1997
Robert Craig wrote: > > 2. Bit shifting for Euphoria. Much needed Speed increase > > The speed ratio between shifting versus multiplying or dividing > by a power of two, would not be as great in Euphoria as it > is in C or assembly language. Each operation in Euphoria > has a bit of overhead attached to it. Nevertheless it's probably > worth adding shifts. (integer divide by the constant "2" is already done > as a shift right). What about dividing by constant powers of 2? Is this done using a number of shift right's? I have been using fixed point arithmetic in some graphics routines I have been working on. The whole number portion of the value is stored in the upper two bytes of a Euphoria integer and the fractional part in the lower two bytes. To access the whole number only, I have to divide the value by 2^16 (65536). My code just screams at me "shift optimization!" If I knew that this was happening already I might be a little more comfortable. Or better yet, a integer divide by 65536 would be the same as moving the the high word into the low word and zeroing the high word. > Regards, > Rob Craig > Rapid Deployment Software Thanks for letting me rant about bit-shifting again -- _____ _____ _____ ________ /\ \ /\ \ /\ \ / \ \ / \____\ / \____\ / \____\ / _ \____\ / / ___/_ / /____/ / / ___/_ / / \ |____|/ / /\____\ / \ \ / / /\____\ \ \_/ / / \ \/ / ___/_\ \ \ \ \/ / ___/_ \ /____/ \ / /\ \\/\ \ \ \ / /\ \ \ \ \ \ \/ \____\ \ \ \ \ \/ \____\ \ \ \ \ / / \ \____\ \ / / \ \____\ \ / / \ / / \ / / \ / / \ / / \/____/ \ / / \/____/ \/____/ \/____/