summaryrefslogtreecommitdiff
path: root/src/cairo-slope.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2008-10-06 16:13:21 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2008-10-07 01:45:45 +0100
commitc6a6bf580fa7036e4c28137f8c038beb5c347244 (patch)
tree4d22434100c79c2b3b7fb84cafb8f04731f2f1e3 /src/cairo-slope.c
parent5e3fcb7934f568bb7e304a1c434a9370b693df17 (diff)
downloadcairo-c6a6bf580fa7036e4c28137f8c038beb5c347244.tar.gz
[slope] Replace open-coding 64bit integer arithmetic.
Prefer to use the operations form cairo-wideint-private.h in order to improve readability and reduce our assumptions on the availability of 64bit integers.
Diffstat (limited to 'src/cairo-slope.c')
-rw-r--r--src/cairo-slope.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/cairo-slope.c b/src/cairo-slope.c
index e3a070b38..35c537221 100644
--- a/src/cairo-slope.c
+++ b/src/cairo-slope.c
@@ -66,15 +66,13 @@ _cairo_slope_init (cairo_slope_t *slope,
int
_cairo_slope_compare (const cairo_slope_t *a, const cairo_slope_t *b)
{
- cairo_fixed_48_16_t diff;
+ cairo_int64_t ady_bdx = _cairo_int32x32_64_mul (a->dy, b->dx);
+ cairo_int64_t bdy_adx = _cairo_int32x32_64_mul (b->dy, a->dx);
+ int cmp;
- diff = ((cairo_fixed_48_16_t) a->dy * (cairo_fixed_48_16_t) b->dx
- - (cairo_fixed_48_16_t) b->dy * (cairo_fixed_48_16_t) a->dx);
-
- if (diff > 0)
- return 1;
- if (diff < 0)
- return -1;
+ cmp = _cairo_int64_cmp (ady_bdx, bdy_adx);
+ if (cmp)
+ return cmp;
/* special-case zero vectors. the intended logic here is:
* zero vectors all compare equal, and more positive than any