added --disable-fast-fp-converions configure option
authorTomas Frydrych <tf@openedhand.com>
Wed, 25 Jul 2007 18:17:13 +0000 (18:17 +0000)
committerTomas Frydrych <tf@openedhand.com>
Wed, 25 Jul 2007 18:17:13 +0000 (18:17 +0000)
ChangeLog
clutter/clutter-fixed.c
configure.ac

index 1688bd9..37a3958 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2007-07-25  Tomas Frydrych  <tf@openedhand.com>
+
+       * configure.ac:
+       * clutter/clutter-fixed.c:
+
+       Added --disable-fast-fp-conversion option.
+       
 2007-07-25  Emmanuele Bassi  <ebassi@openedhand.com>
 
        * clutter/clutter-label.[ch]: Ouch, clutter_label_get_alignment()
index 824e5d5..1b77367 100644 (file)
@@ -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
index 013e99b..69cf687 100644 (file)
@@ -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}"