Skip to content

Commit

Permalink
[tessellator] Avoid implicit promotion to 64bit integer.
Browse files Browse the repository at this point in the history
Avoid passing a 32bit integer as a cairo_int64_t in case we do not have a
64bit native integral type. As a side-effect this means we can also use a
narrower multiply.
  • Loading branch information
Chris Wilson committed Oct 7, 2008
1 parent eaa4bd1 commit 6b8c055
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/cairo-bentley-ottmann.c
Original file line number Diff line number Diff line change
Expand Up @@ -584,17 +584,17 @@ det32_64 (int32_t a,
}

static inline cairo_int128_t
det64_128 (cairo_int64_t a,
cairo_int64_t b,
cairo_int64_t c,
cairo_int64_t d)
det64x32_128 (cairo_int64_t a,
int32_t b,
cairo_int64_t c,
int32_t d)
{
cairo_int128_t ad;
cairo_int128_t bc;

/* det = a * d - b * c */
ad = _cairo_int64x64_128_mul (a, d);
bc = _cairo_int64x64_128_mul (b, c);
ad = _cairo_int64x32_128_mul (a, d);
bc = _cairo_int64x32_128_mul (c, b);

return _cairo_int128_sub (ad, bc);
}
Expand Down Expand Up @@ -636,17 +636,17 @@ intersect_lines (cairo_bo_edge_t *a,
b->bottom.x, b->bottom.y);

/* x = det (a_det, dx1, b_det, dx2) / den_det */
qr = _cairo_int_96by64_32x64_divrem (det64_128 (a_det, dx1,
b_det, dx2),
qr = _cairo_int_96by64_32x64_divrem (det64x32_128 (a_det, dx1,
b_det, dx2),
den_det);
if (_cairo_int64_eq (qr.rem, den_det))
return CAIRO_BO_STATUS_NO_INTERSECTION;
intersection->x.ordinate = qr.quo;
intersection->x.exactness = qr.rem ? INEXACT : EXACT;

/* y = det (a_det, dy1, b_det, dy2) / den_det */
qr = _cairo_int_96by64_32x64_divrem (det64_128 (a_det, dy1,
b_det, dy2),
qr = _cairo_int_96by64_32x64_divrem (det64x32_128 (a_det, dy1,
b_det, dy2),
den_det);
if (_cairo_int64_eq (qr.rem, den_det))
return CAIRO_BO_STATUS_NO_INTERSECTION;
Expand Down

0 comments on commit 6b8c055

Please sign in to comment.