mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-05 12:18:01 +02:00
[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.
This commit is contained in:
parent
5e3fcb7934
commit
c6a6bf580f
1 changed files with 6 additions and 8 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue