Re: and_bits() behavior

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

Juergen Luethje wrote:
> 
> c.k.lester wrote:
> 
> > Should this be right?
> > 
> > ADMIN_ONLY = 128
> > btype = -1
> > 
> > ?and_bits(ADMIN_ONLY,btype)
> > 
> > It's returning 128!
> 
> That's OK.
> Run the following code, and maybe then you can solve the riddle yourself. smile
> }}}
<eucode>
> include machine.e
> ? int_to_bits(-1, 8)
> </eucode>
{{{

> Regards,
>    Juergen

BTW, I experimented with this today. The highest bit count that I could go to
and still get all ones was 53. At 54 and above, I got all zeroes.

--
"Any programming problem can be solved by adding a level of indirection."
--anonymous
"Any performance problem can be solved by removing a level of indirection."
--M. Haertel
"Premature optimization is the root of all evil in programming."
--C.A.R. Hoare
j.

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

Search



Quick Links

User menu

Not signed in.

Misc Menu