Re: Euphoria Standard Library

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

aku at inbox.as wrote:

> -- eqv_bits only for 0-255 number
> global function eqv_bits(atom a, atom b)
>     sequence abit, bbit, tp
>     
>     abit=int_to_bits(a, 8)
>     bbit=int_to_bits(b, 8)
>     tp=repeat(0,8)
>     
>     for i=1 to length(abit) do
>         if abit[i]=bbit[i] then
>             tp[i]=1
>         else
>             tp[i]=0
>         end if
>     end for        
>     
>     return bits_to_int(tp)
> end function

Pardon me 'function'ing again... :)

global function eqv_8bits(integer a, integer b)
    return 255-and_bits(xor_bits(a,b),255)
end function

Carl

-- 
Carl R White - aka - Cyrek
eMail: carlw at legend.co.uk
       cyrek at bigfoot.com
URL:   www.carlw.legend.yorks.com - nothing there yet though

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

Search



Quick Links

User menu

Not signed in.

Misc Menu