Re: c macro

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

On Tue, 28 Mar 2000 21:48:01 +0200, =?iso-8859-2?B?qWtvZGE=?=
<tone.skoda at SIOL.NET> wrote:

>could somebody translate me this c macro to euphoria and explain general
procedure how to do others
>
>#define HRESULT_FACILITY(hr) (((hr) >> 16) & 0x1fff)
>
>what >>,<<,... means?
>

They mean shift bits right, and shift bits left, respectively.

You can accomplish this in Euphoria by dividing and multiplying by powers of
2.

function shiftRight(atom x, integer count)
  return floor(x / power(2, count))
end function

function shiftLeft(atom x, integer count)
  return x * power(2, count)
end function


Your macro would be:
  return and_bits(floor(hr / power(2, 16)), #1FFF)


Regards,
-- Pete
*now scurrying away to install beos 5 in order to port Peu to it*

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

Search



Quick Links

User menu

Not signed in.

Misc Menu