1. shift bits left 8
- Posted by John E. Franklin <johnericfranklin at rock.com> Jan 21, 2006
- 540 views
Do I multiply an atom by 256 to shift bits left by 8 or is there a more efficient way like << in C ?
2. Re: shift bits left 8
- Posted by Jason Gade <jaygade at yahoo.com> Jan 21, 2006
- 554 views
John E. Franklin wrote: > > Do I multiply an atom by 256 to shift bits left by 8 or > is there a more efficient way like << in C ? From the reference manual, I know that multiplying by 2 is optimized internally, and I think that power(2,x) is also. I don't know about multiplying by other multiples of 2. -- "The author regrets that he is unable to reconcile himself to the thoughtful point of view you have expressed. However, it must be kept in mind that being raised in different cultures and different places can result in such differences of viewpoint between individuals. The author is from planet Earth." [author unknown] j.
3. Re: shift bits left 8
- Posted by Greg Haberek <ghaberek at gmail.com> Jan 21, 2006
- 537 views
> From the reference manual, I know that multiplying by 2 is optimized int= ernally, and I think that power(2,x) is also. I don't know about multiplyin= g by other multiples of 2.
global function shift_left( integer x, integer bits ) return x * power( 2, bits ) end function global function shift_right( integer x, integer bits ) return floor( x / power( 2, bits ) ) end function
~Greg
4. Re: shift bits left 8
- Posted by John E. Franklin <johnericfranklin at rock.com> Jan 21, 2006
- 527 views
- Last edited Jan 22, 2006
Thanks for the information, both of you.