From 2c97bdf4561797d3d372fe00847e6853eefb3f30 Mon Sep 17 00:00:00 2001 From: Tomas Frydrych Date: Wed, 25 Jul 2007 18:17:13 +0000 Subject: [PATCH] added --disable-fast-fp-converions configure option --- ChangeLog | 7 +++++++ clutter/clutter-fixed.c | 18 +++++++++++++++--- configure.ac | 21 ++++++++++++++++++++- 3 files changed, 42 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1688bd95a..37a3958dc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-07-25 Tomas Frydrych + + * configure.ac: + * clutter/clutter-fixed.c: + + Added --disable-fast-fp-conversion option. + 2007-07-25 Emmanuele Bassi * clutter/clutter-label.[ch]: Ouch, clutter_label_get_alignment() diff --git a/clutter/clutter-fixed.c b/clutter/clutter-fixed.c index 824e5d534..1b7736721 100644 --- a/clutter/clutter-fixed.c +++ b/clutter/clutter-fixed.c @@ -856,6 +856,9 @@ const double _magic = 68719476736.0*1.5; ClutterFixed _clutter_double_to_fixed (double val) { +#ifdef CFX_NO_FAST_CONVERSIONS + return (ClutterFixed)(val * (double)CFX_ONE); +#else union { double d; @@ -864,7 +867,8 @@ _clutter_double_to_fixed (double val) dbl.d = val; dbl.d = dbl.d + _magic; - return dbl.i[0]; + return dbl.i[0]; +#endif } /* @@ -881,6 +885,9 @@ _clutter_double_to_fixed (double val) gint _clutter_double_to_int (double val) { +#ifdef CFX_NO_FAST_CONVERSIONS + return (gint)(val); +#else union { double d; @@ -889,12 +896,16 @@ _clutter_double_to_int (double val) dbl.d = val; dbl.d = dbl.d + _magic; - return ((int)dbl.i[0]) >> 16; + return ((int)dbl.i[0]) >> 16; +#endif } guint _clutter_double_to_uint (double val) { +#ifdef CFX_NO_FAST_CONVERSIONS + return (guint)(val); +#else union { double d; @@ -903,7 +914,8 @@ _clutter_double_to_uint (double val) dbl.d = val; dbl.d = dbl.d + _magic; - return (dbl.i[0]) >> 16; + return (dbl.i[0]) >> 16; +#endif } #undef _CFX_MAN diff --git a/configure.ac b/configure.ac index 013e99b6c..69cf687e1 100644 --- a/configure.ac +++ b/configure.ac @@ -299,6 +299,22 @@ fi AC_SUBST(CLUTTER_DEBUG_CFLAGS) +dnl = Disable fast floating point conversions ============================== + +AC_ARG_ENABLE(fast-fp-conversions, + AC_HELP_STRING([--disable-fast-fp-conversions=@<:@no/yes@:>@], + [Turn off fast conversion from floating point to int. no: fast floating point conversion are enabled. yes: fast floating point conversions are disabled. @<:@default=no@:>@]), +, + enable_fast_fp_conversions=yes) + +if test "x$enable_fast_fp_conversions" = "xno"; then + FIXED_POINT_CFLAGS="$FIXED_POINT_CFLAGS -DCFX_NO_FAST_CONVERSIONS" +else + FIXED_POINT_CFLAGS="$FIXED_POINT_CFLAGS -UCFX_NO_FAST_CONVERSIONS" +fi + +AC_SUBST(FIXED_POINT_CFLAGS) + dnl = GTK Doc check ======================================================== GTK_DOC_CHECK([1.6]) @@ -328,7 +344,9 @@ dnl ======================================================================== AC_SUBST(GCC_FLAGS) -CLUTTER_CFLAGS="$SDL_CFLAGS $EGL_CFLAGS $GLX_CFLAGS $CLUTTER_DEPS_CFLAGS" +CLUTTER_CFLAGS="$SDL_CFLAGS $EGL_CFLAGS $GLX_CFLAGS $CLUTTER_DEPS_CFLAGS \ + $FIXED_POINT_CFLAGS" + CLUTTER_LIBS="$SDL_LIBS $EGL_LIBS $GLX_LIBS $CLUTTER_DEPS_LIBS" AC_SUBST(CLUTTER_CFLAGS) @@ -368,6 +386,7 @@ echo "" echo " Flavour: ${clutterbackend}" echo " Target library: ${clutterbackendlib}" echo " Debug level: ${enable_debug}" +echo " Fast FP conversions: ${enable_fast_fp_conversions}" echo " API Documentation: ${enable_gtk_doc}" echo " Manual Documentation: ${enable_manual}" echo " FPU: ${with_fpu}"