From 5b92cc21cbceb3ff6a49479f3dcc44aaf6a9dad7 Mon Sep 17 00:00:00 2001 From: Tomas Frydrych Date: Wed, 25 Jul 2007 18:34:05 +0000 Subject: [PATCH] fixed endianness issue in fast fp conversions --- ChangeLog | 6 ++++++ clutter/clutter-fixed.c | 12 +++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 37a3958dc..716076d58 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-07-25 Tomas Frydrych + + * clutter/clutter-fixed.c: + + Fixed endianness issue in fast fp conversions. + 2007-07-25 Tomas Frydrych * configure.ac: diff --git a/clutter/clutter-fixed.c b/clutter/clutter-fixed.c index 1b7736721..b7d68a761 100644 --- a/clutter/clutter-fixed.c +++ b/clutter/clutter-fixed.c @@ -837,10 +837,12 @@ clutter_powx (guint x, ClutterFixed y) const double _magic = 68719476736.0*1.5; /* Where in the 64 bits of double is the mantisa */ -#ifdef LITTLE_ENDIAN +#if (__FLOAT_WORD_ORDER == 1234) #define _CFX_MAN 0 -#else +#elif (__FLOAT_WORD_ORDER == 4321) #define _CFX_MAN 1 +#else +#define CFX_NO_FAST_CONVERSIONS #endif /* @@ -867,7 +869,7 @@ _clutter_double_to_fixed (double val) dbl.d = val; dbl.d = dbl.d + _magic; - return dbl.i[0]; + return dbl.i[_CFX_MAN]; #endif } @@ -896,7 +898,7 @@ _clutter_double_to_int (double val) dbl.d = val; dbl.d = dbl.d + _magic; - return ((int)dbl.i[0]) >> 16; + return ((int)dbl.i[_CFX_MAN]) >> 16; #endif } @@ -914,7 +916,7 @@ _clutter_double_to_uint (double val) dbl.d = val; dbl.d = dbl.d + _magic; - return (dbl.i[0]) >> 16; + return (dbl.i[_CFX_MAN]) >> 16; #endif }