added --disable-fast-fp-converions configure option

This commit is contained in:
Tomas Frydrych 2007-07-25 18:17:13 +00:00
parent a57acd0275
commit 2c97bdf456
3 changed files with 42 additions and 4 deletions

View File

@ -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> 2007-07-25 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-label.[ch]: Ouch, clutter_label_get_alignment() * clutter/clutter-label.[ch]: Ouch, clutter_label_get_alignment()

View File

@ -856,6 +856,9 @@ const double _magic = 68719476736.0*1.5;
ClutterFixed ClutterFixed
_clutter_double_to_fixed (double val) _clutter_double_to_fixed (double val)
{ {
#ifdef CFX_NO_FAST_CONVERSIONS
return (ClutterFixed)(val * (double)CFX_ONE);
#else
union union
{ {
double d; double d;
@ -865,6 +868,7 @@ _clutter_double_to_fixed (double val)
dbl.d = val; dbl.d = val;
dbl.d = dbl.d + _magic; 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 gint
_clutter_double_to_int (double val) _clutter_double_to_int (double val)
{ {
#ifdef CFX_NO_FAST_CONVERSIONS
return (gint)(val);
#else
union union
{ {
double d; double d;
@ -890,11 +897,15 @@ _clutter_double_to_int (double val)
dbl.d = val; dbl.d = val;
dbl.d = dbl.d + _magic; dbl.d = dbl.d + _magic;
return ((int)dbl.i[0]) >> 16; return ((int)dbl.i[0]) >> 16;
#endif
} }
guint guint
_clutter_double_to_uint (double val) _clutter_double_to_uint (double val)
{ {
#ifdef CFX_NO_FAST_CONVERSIONS
return (guint)(val);
#else
union union
{ {
double d; double d;
@ -904,6 +915,7 @@ _clutter_double_to_uint (double val)
dbl.d = val; dbl.d = val;
dbl.d = dbl.d + _magic; dbl.d = dbl.d + _magic;
return (dbl.i[0]) >> 16; return (dbl.i[0]) >> 16;
#endif
} }
#undef _CFX_MAN #undef _CFX_MAN

View File

@ -299,6 +299,22 @@ fi
AC_SUBST(CLUTTER_DEBUG_CFLAGS) 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 ======================================================== dnl = GTK Doc check ========================================================
GTK_DOC_CHECK([1.6]) GTK_DOC_CHECK([1.6])
@ -328,7 +344,9 @@ dnl ========================================================================
AC_SUBST(GCC_FLAGS) 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" CLUTTER_LIBS="$SDL_LIBS $EGL_LIBS $GLX_LIBS $CLUTTER_DEPS_LIBS"
AC_SUBST(CLUTTER_CFLAGS) AC_SUBST(CLUTTER_CFLAGS)
@ -368,6 +386,7 @@ echo ""
echo " Flavour: ${clutterbackend}" echo " Flavour: ${clutterbackend}"
echo " Target library: ${clutterbackendlib}" echo " Target library: ${clutterbackendlib}"
echo " Debug level: ${enable_debug}" echo " Debug level: ${enable_debug}"
echo " Fast FP conversions: ${enable_fast_fp_conversions}"
echo " API Documentation: ${enable_gtk_doc}" echo " API Documentation: ${enable_gtk_doc}"
echo " Manual Documentation: ${enable_manual}" echo " Manual Documentation: ${enable_manual}"
echo " FPU: ${with_fpu}" echo " FPU: ${with_fpu}"