[prev in list] [next in list] [prev in thread] [next in thread] 

List:       scilab-dev
Subject:    Re: [Scilab-Dev] bitand, bitor
From:       Pierre MARECHAL <pierre.marechal () inria ! fr>
Date:       2008-02-06 10:07:53
Message-ID: 47A986F9.50404 () inria ! fr
[Download RAW message or body]

Hi Enrico,

These functions have been written by a developper that has left the team 
and I don't why bitor() and bitand() are coded in this way.
For the time being, I've just dealed with argument check without paying 
attention to the algorithm.
But you're totally right, I'll use & and | operators.

Thanks

Regards

Pierre



Enrico Segre a écrit :
> Hi there,
> the recent bug activity about bitand, bitor & the like made me wonder
> and look a bit into the functions themselves. Maybe I miss something,
> but why at all does one need these contraptions? As they are written,
> besides argument parsing, now these functions use an absurd detour via
> converting their arguments to "binary" string, then to ascii codes, then
> make string substitutions, then again convert back to floats - all this
> is certainly not performant. Why can't one just use int32(x) &
> int32(y)? 
> Is there a consideration of MAXINT? (a float can represent a 52bit
> integer without loss of precision, which is more than 32bit -- consider
> dec2hex(2^53+[-2:2]) But even then, that could be treated appropriately
> without waiting for int64, say, with
>
> a=2^32
> z=double(int32(x/a) & int32(y/a))*a 
> z=z+double(int32(x-z) & int32(y-z))
>
> Enrico
>   

-- 
===================================================
Pierre MARECHAL
INRIA - Centre de Recherche de Paris - Rocquencourt
Domaine de Voluceau - B.P. 105
78153 Le Chesnay Cedex
===================================================
Equipe-Projet Scilab
Bâtiment 1B - Bureau 008
Email : pierre.marechal@inria.fr
===================================================


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic