[cairo] Re: Some other bits...

Bertram Felgenhauer bertram.felgenhauer at googlemail.com
Thu Aug 18 16:59:14 PDT 2005


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.

But it does not even work; the top bits are also added if b is positive,
giving an incorrect result.

Bertram


More information about the cairo mailing list