2008-04-09 Emmanuele Bassi <ebassi@openedhand.com>

* 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.
This commit is contained in:
Emmanuele Bassi 2008-04-09 10:51:15 +00:00
parent b4ab8b63a1
commit cf4ba6c512
4 changed files with 127 additions and 106 deletions

View File

@ -1,3 +1,14 @@
2008-04-09 Emmanuele Bassi <ebassi@openedhand.com>
* 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 <neil@o-hand.com>
Applied patch from bug #871

View File

@ -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 "$@"
./configure "$@" ${GTK_DOC_ARGS}
echo "Now type 'make' to compile $PROJECT."

View File

@ -148,6 +148,94 @@ static ClutterFixed sin_tbl [] =
*/
#define CFX_SIN_STEP 0x00000192
/* <private> */
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)));
}
/* <private> */
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

View File

@ -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);
/* <private> */
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