1. shift bits left 8

Do I multiply an atom by 256 to shift bits left by 8 or
is there a more efficient way like << in C ?

new topic     » topic index » view message » categorize

2. Re: shift bits left 8

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.

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

3. Re: shift bits left 8

>  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

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

4. Re: shift bits left 8

Thanks for the information, both of you.

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

Search



Quick Links

User menu

Not signed in.

Misc Menu