fixed endianness issue in fast fp conversions

This commit is contained in:
Tomas Frydrych 2007-07-25 18:34:05 +00:00
parent 2c97bdf456
commit 5b92cc21cb
2 changed files with 13 additions and 5 deletions

View File

@ -1,3 +1,9 @@
2007-07-25 Tomas Frydrych <tf@openedhand.com>
* clutter/clutter-fixed.c:
Fixed endianness issue in fast fp conversions.
2007-07-25 Tomas Frydrych <tf@openedhand.com>
* configure.ac:

View File

@ -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
}