gfx/cairo/lround-c99-only.patch

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial