[cairo] Re: Some other bits...
behdad at cs.toronto.edu
Thu Aug 18 18:07:49 PDT 2005
On Thu, 18 Aug 2005, Bertram Felgenhauer wrote:
> On 8/18/05, Behdad Esfahbod <behdad at cs.toronto.edu> wrote:
> > > There's a standard trick for this, though. If you want to guarantee
> > > arithmetic (signed) right shift, you can say:
> > >
> > > a = (b >> shift) | ~(-1 >> shift);
> > Then you fall into another hole: it assumes 2-complete arithmetic ;).
> 2's complement, I think.
Oops. I knew it's time to go to sleep. (and still is)
> But it does not even work; the top bits are also added if b is positive,
> giving an incorrect result.
Ah, right. I was too amused by it.
More information about the cairo