gfx/cairo/lround-c99-only.patch

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/cairo/lround-c99-only.patch	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,46 @@
     1.4 +Only use lround in C99 programs.
     1.5 +
     1.6 +diff --git a/gfx/cairo/cairo/src/cairo-misc.c b/gfx/cairo/cairo/src/cairo-misc.c
     1.7 +--- a/gfx/cairo/cairo/src/cairo-misc.c
     1.8 ++++ b/gfx/cairo/cairo/src/cairo-misc.c
     1.9 +@@ -478,17 +478,17 @@ _cairo_operator_bounded_by_either (cairo
    1.10 +     case CAIRO_OPERATOR_IN:
    1.11 +     case CAIRO_OPERATOR_DEST_IN:
    1.12 +     case CAIRO_OPERATOR_DEST_ATOP:
    1.13 + 	return 0;
    1.14 +     }
    1.15 + 
    1.16 + }
    1.17 + 
    1.18 +-#if DISABLE_SOME_FLOATING_POINT
    1.19 ++#if DISABLE_SOME_FLOATING_POINT || __STDC_VERSION__ < 199901L
    1.20 + /* This function is identical to the C99 function lround(), except that it
    1.21 +  * performs arithmetic rounding (floor(d + .5) instead of away-from-zero rounding) and
    1.22 +  * has a valid input range of (INT_MIN, INT_MAX] instead of
    1.23 +  * [INT_MIN, INT_MAX]. It is much faster on both x86 and FPU-less systems
    1.24 +  * than other commonly used methods for rounding (lround, round, rint, lrint
    1.25 +  * or float (d + 0.5)).
    1.26 +  *
    1.27 +  * The reason why this function is much faster on x86 than other
    1.28 +diff --git a/gfx/cairo/cairo/src/cairoint.h b/gfx/cairo/cairo/src/cairoint.h
    1.29 +--- a/gfx/cairo/cairo/src/cairoint.h
    1.30 ++++ b/gfx/cairo/cairo/src/cairoint.h
    1.31 +@@ -969,17 +969,17 @@ _cairo_restrict_value (double value, dou
    1.32 +  * away from 0. _cairo_round rounds halfway cases toward negative infinity.
    1.33 +  * This matches the rounding behaviour of _cairo_lround. */
    1.34 + static inline double cairo_const
    1.35 + _cairo_round (double r)
    1.36 + {
    1.37 +     return floor (r + .5);
    1.38 + }
    1.39 + 
    1.40 +-#if DISABLE_SOME_FLOATING_POINT
    1.41 ++#if DISABLE_SOME_FLOATING_POINT || __STDC_VERSION__ < 199901L
    1.42 + cairo_private int
    1.43 + _cairo_lround (double d) cairo_const;
    1.44 + #else
    1.45 + #define _cairo_lround lround
    1.46 + #endif
    1.47 + 
    1.48 + cairo_private uint16_t
    1.49 + _cairo_half_from_float (float f) cairo_const;

mercurial