[cairo] Tessellator performance patch
daniel.amelang at gmail.com
Tue Dec 5 13:10:53 PST 2006
On 12/5/06, Behdad Esfahbod <behdad at behdad.org> wrote:
> On Mon, 2006-12-04 at 19:35 -0500, Rafael Villar Burke wrote:
> > + cairo_bool_t proper_intersection = (!(crossp_abc > 0) ^
> > !(crossp_abd > 0)) &&
> > + (!(crossp_cda > 0) ^ !(crossp_cdb > 0));
> Nitpicking: Isn't !x ^ !y equivalent to x ^ y?
And since we're treating the result at a boolean value, why not just say:
((crossp_abc > 0) != (crossp_abd > 0)) && ((crossp_cda > 0) != (crossp_cdb > 0))
which better captures the intent, IMO. I don't think the XOR is going
to get you any meaningful speedup, if that's why they were originally
used. Regardless, I'd leave this to the compilers, as they are usually
better than we are at this type of optimization.
More information about the cairo