|
1 Only use lround in C99 programs. |
|
2 |
|
3 diff --git a/gfx/cairo/cairo/src/cairo-misc.c b/gfx/cairo/cairo/src/cairo-misc.c |
|
4 --- a/gfx/cairo/cairo/src/cairo-misc.c |
|
5 +++ b/gfx/cairo/cairo/src/cairo-misc.c |
|
6 @@ -478,17 +478,17 @@ _cairo_operator_bounded_by_either (cairo |
|
7 case CAIRO_OPERATOR_IN: |
|
8 case CAIRO_OPERATOR_DEST_IN: |
|
9 case CAIRO_OPERATOR_DEST_ATOP: |
|
10 return 0; |
|
11 } |
|
12 |
|
13 } |
|
14 |
|
15 -#if DISABLE_SOME_FLOATING_POINT |
|
16 +#if DISABLE_SOME_FLOATING_POINT || __STDC_VERSION__ < 199901L |
|
17 /* This function is identical to the C99 function lround(), except that it |
|
18 * performs arithmetic rounding (floor(d + .5) instead of away-from-zero rounding) and |
|
19 * has a valid input range of (INT_MIN, INT_MAX] instead of |
|
20 * [INT_MIN, INT_MAX]. It is much faster on both x86 and FPU-less systems |
|
21 * than other commonly used methods for rounding (lround, round, rint, lrint |
|
22 * or float (d + 0.5)). |
|
23 * |
|
24 * The reason why this function is much faster on x86 than other |
|
25 diff --git a/gfx/cairo/cairo/src/cairoint.h b/gfx/cairo/cairo/src/cairoint.h |
|
26 --- a/gfx/cairo/cairo/src/cairoint.h |
|
27 +++ b/gfx/cairo/cairo/src/cairoint.h |
|
28 @@ -969,17 +969,17 @@ _cairo_restrict_value (double value, dou |
|
29 * away from 0. _cairo_round rounds halfway cases toward negative infinity. |
|
30 * This matches the rounding behaviour of _cairo_lround. */ |
|
31 static inline double cairo_const |
|
32 _cairo_round (double r) |
|
33 { |
|
34 return floor (r + .5); |
|
35 } |
|
36 |
|
37 -#if DISABLE_SOME_FLOATING_POINT |
|
38 +#if DISABLE_SOME_FLOATING_POINT || __STDC_VERSION__ < 199901L |
|
39 cairo_private int |
|
40 _cairo_lround (double d) cairo_const; |
|
41 #else |
|
42 #define _cairo_lround lround |
|
43 #endif |
|
44 |
|
45 cairo_private uint16_t |
|
46 _cairo_half_from_float (float f) cairo_const; |