From cf4ba6c512377113c014a6cf675fc3096cf38dfd Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Wed, 9 Apr 2008 10:51:15 +0000 Subject: [PATCH] 2008-04-09 Emmanuele Bassi * autogen.sh: Clean up a bit * clutter/clutter-fixed.[ch]: (clutter_double_to_fixed), (clutter_double_to_int), (clutter_double_to_uint): Make these functions public, as they are expanded by their respective macros. This fixes the errors from the linker trying to resolve their name. --- ChangeLog | 11 +++ autogen.sh | 21 +++++- clutter/clutter-fixed.c | 178 ++++++++++++++++++++++++------------------------ clutter/clutter-fixed.h | 23 +++---- 4 files changed, 127 insertions(+), 106 deletions(-) diff --git a/ChangeLog b/ChangeLog index 796b7c0..c054931 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2008-04-09 Emmanuele Bassi + + * autogen.sh: Clean up a bit + + * clutter/clutter-fixed.[ch]: + (clutter_double_to_fixed), + (clutter_double_to_int), + (clutter_double_to_uint): Make these functions public, as they + are expanded by their respective macros. This fixes the errors + from the linker trying to resolve their name. + 2008-04-09 Neil Roberts Applied patch from bug #871 diff --git a/autogen.sh b/autogen.sh index 1836f8b..9c61882 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,7 +1,22 @@ #! /bin/sh -gtkdocize || exit 1 + +srcdir=`dirname $0` +test -z "$srcdir" && srcdir=. + +PROJECT=Clutter +TEST_TYPE=-d +FILE=clutter + +test $TEST_TYPE $FILE || { + echo "You must run this script in the top-level $PROJECT directory" + exit 1 +} + +gtkdocize || exit $? # back in the stupidity of autoreconf -autoreconf -v --install || exit 1 +autoreconf -v --install || exit $? + +./configure "$@" ${GTK_DOC_ARGS} -./configure "$@" +echo "Now type 'make' to compile $PROJECT." diff --git a/clutter/clutter-fixed.c b/clutter/clutter-fixed.c index f978325..cf0964e 100644 --- a/clutter/clutter-fixed.c +++ b/clutter/clutter-fixed.c @@ -148,6 +148,94 @@ static ClutterFixed sin_tbl [] = */ #define CFX_SIN_STEP 0x00000192 +/* */ +const double _magic = 68719476736.0 * 1.5; + +/* Where in the 64 bits of double is the mantisa */ +#if (__FLOAT_WORD_ORDER == 1234) +#define _CFX_MAN 0 +#elif (__FLOAT_WORD_ORDER == 4321) +#define _CFX_MAN 1 +#else +#define CFX_NO_FAST_CONVERSIONS +#endif + +/* + * clutter_double_to_fixed : + * @value: value to be converted + * + * A fast conversion from double precision floating to fixed point + * + * Return value: Fixed point representation of the value + * + * Since: 0.2 + */ +ClutterFixed +clutter_double_to_fixed (double val) +{ +#ifdef CFX_NO_FAST_CONVERSIONS + return (ClutterFixed)(val * (double)CFX_ONE); +#else + union + { + double d; + unsigned int i[2]; + } dbl; + + dbl.d = val; + dbl.d = dbl.d + _magic; + return dbl.i[_CFX_MAN]; +#endif +} + +/* + * clutter_double_to_int : + * @value: value to be converted + * + * A fast conversion from doulbe precision floatint point to int; + * used this instead of casting double/float to int. + * + * Return value: Integer part of the double + * + * Since: 0.2 + */ +gint +clutter_double_to_int (double val) +{ +#ifdef CFX_NO_FAST_CONVERSIONS + return (gint)(val); +#else + union + { + double d; + unsigned int i[2]; + } dbl; + + dbl.d = val; + dbl.d = dbl.d + _magic; + return ((int)dbl.i[_CFX_MAN]) >> 16; +#endif +} + +guint +clutter_double_to_uint (double val) +{ +#ifdef CFX_NO_FAST_CONVERSIONS + return (guint)(val); +#else + union + { + double d; + unsigned int i[2]; + } dbl; + + dbl.d = val; + dbl.d = dbl.d + _magic; + return (dbl.i[_CFX_MAN]) >> 16; +#endif +} + +#undef _CFX_MAN /** * clutter_sinx: @@ -884,93 +972,3 @@ clutter_powx (guint x, ClutterFixed y) return clutter_pow2x (CFX_MUL (y, clutter_log2x (x))); } - -/* */ -const double _magic = 68719476736.0*1.5; - -/* Where in the 64 bits of double is the mantisa */ -#if (__FLOAT_WORD_ORDER == 1234) -#define _CFX_MAN 0 -#elif (__FLOAT_WORD_ORDER == 4321) -#define _CFX_MAN 1 -#else -#define CFX_NO_FAST_CONVERSIONS -#endif - -/* - * clutter_double_to_fixed : - * @value: value to be converted - * - * A fast conversion from double precision floating to fixed point - * - * Return value: Fixed point representation of the value - * - * Since: 0.2 - */ -ClutterFixed -_clutter_double_to_fixed (double val) -{ -#ifdef CFX_NO_FAST_CONVERSIONS - return (ClutterFixed)(val * (double)CFX_ONE); -#else - union - { - double d; - unsigned int i[2]; - } dbl; - - dbl.d = val; - dbl.d = dbl.d + _magic; - return dbl.i[_CFX_MAN]; -#endif -} - -/* - * clutter_double_to_int : - * @value: value to be converted - * - * A fast conversion from doulbe precision floatint point to int; - * used this instead of casting double/float to int. - * - * Return value: Integer part of the double - * - * Since: 0.2 - */ -gint -_clutter_double_to_int (double val) -{ -#ifdef CFX_NO_FAST_CONVERSIONS - return (gint)(val); -#else - union - { - double d; - unsigned int i[2]; - } dbl; - - dbl.d = val; - dbl.d = dbl.d + _magic; - return ((int)dbl.i[_CFX_MAN]) >> 16; -#endif -} - -guint -_clutter_double_to_uint (double val) -{ -#ifdef CFX_NO_FAST_CONVERSIONS - return (guint)(val); -#else - union - { - double d; - unsigned int i[2]; - } dbl; - - dbl.d = val; - dbl.d = dbl.d + _magic; - return (dbl.i[_CFX_MAN]) >> 16; -#endif -} - -#undef _CFX_MAN - diff --git a/clutter/clutter-fixed.h b/clutter/clutter-fixed.h index f2aa885..2e5c14d 100644 --- a/clutter/clutter-fixed.h +++ b/clutter/clutter-fixed.h @@ -175,7 +175,7 @@ typedef gint32 ClutterAngle; /* angle such that 1024 == 2*PI */ * * Convert a float value to fixed. */ -#define CLUTTER_FLOAT_TO_FIXED(x) (_clutter_double_to_fixed ((x))) +#define CLUTTER_FLOAT_TO_FIXED(x) (clutter_double_to_fixed ((x))) /** * CLUTTER_FLOAT_TO_INT: @@ -183,7 +183,7 @@ typedef gint32 ClutterAngle; /* angle such that 1024 == 2*PI */ * * Convert a float value to int. */ -#define CLUTTER_FLOAT_TO_INT(x) (_clutter_double_to_int ((x))) +#define CLUTTER_FLOAT_TO_INT(x) (clutter_double_to_int ((x))) /** * CLUTTER_FLOAT_TO_UINT: @@ -191,7 +191,7 @@ typedef gint32 ClutterAngle; /* angle such that 1024 == 2*PI */ * * Convert a float value to unsigned int. */ -#define CLUTTER_FLOAT_TO_UINT(x) (_clutter_double_to_uint ((x))) +#define CLUTTER_FLOAT_TO_UINT(x) (clutter_double_to_uint ((x))) /** * CLUTTER_INT_TO_FIXED: @@ -279,10 +279,12 @@ typedef gint32 ClutterAngle; /* angle such that 1024 == 2*PI */ /*< public >*/ /* Fixed point math routines */ extern inline -ClutterFixed clutter_qmulx (ClutterFixed op1, ClutterFixed op2); +ClutterFixed clutter_qmulx (ClutterFixed op1, + ClutterFixed op2); extern inline -ClutterFixed clutter_qdivx (ClutterFixed op1, ClutterFixed op2); +ClutterFixed clutter_qdivx (ClutterFixed op1, + ClutterFixed op2); ClutterFixed clutter_sinx (ClutterFixed angle); ClutterFixed clutter_sini (ClutterAngle angle); @@ -371,14 +373,9 @@ guint clutter_pow2x (ClutterFixed x); guint clutter_powx (guint x, ClutterFixed y); /* */ -extern inline -ClutterFixed _clutter_double_to_fixed (double value); - -extern inline -gint _clutter_double_to_int (double value); - -extern inline -guint _clutter_double_to_uint (double value); +extern ClutterFixed clutter_double_to_fixed (double value); +extern gint clutter_double_to_int (double value); +extern guint clutter_double_to_unit (double value); G_END_DECLS -- 2.7.4