2008-07-03 Tomas Frydrych <tf@openedhand.com>

* clutter/clutter-fixed.h:
	    * clutter/clutter-fixed.c
	    Fixed inlining of clutter_qmulx() and clutter_qdivx() (bug 1022).
This commit is contained in:
Tomas Frydrych 2008-07-03 12:30:36 +00:00
parent 0ee57b37cd
commit f3d5d9d757
3 changed files with 67 additions and 30 deletions

View File

@ -1,3 +1,9 @@
2008-07-03 Tomas Frydrych <tf@openedhand.com>
* clutter/clutter-fixed.h:
* clutter/clutter-fixed.c
Fixed inlining of clutter_qmulx() and clutter_qdivx() (bug 1022).
2008-07-03 Neil Roberts <neil@o-hand.com> 2008-07-03 Neil Roberts <neil@o-hand.com>
* clutter/clutter-shader.c (bind_glsl_shader): Fix a cut-and-paste * clutter/clutter-shader.c (bind_glsl_shader): Fix a cut-and-paste

View File

@ -30,6 +30,7 @@
#include <glib-object.h> #include <glib-object.h>
#include <gobject/gvaluecollector.h> #include <gobject/gvaluecollector.h>
#define G_IMPLEMENTS_INLINES
#include "clutter-fixed.h" #include "clutter-fixed.h"
#include "clutter-private.h" #include "clutter-private.h"

View File

@ -284,13 +284,43 @@ typedef gint32 ClutterAngle; /* angle such that 1024 == 2*PI */
/*< public >*/ /*< public >*/
/* Fixed point math routines */ /* Fixed point math routines */
extern inline G_INLINE_FUNC
ClutterFixed clutter_qmulx (ClutterFixed op1, ClutterFixed clutter_qmulx (ClutterFixed op1,
ClutterFixed op2); ClutterFixed op2);
#if defined (G_CAN_INLINE)
G_INLINE_FUNC
ClutterFixed clutter_qmulx (ClutterFixed op1,
ClutterFixed op2)
{
#ifdef __arm__
int res_low, res_hi;
extern inline __asm__ ("smull %0, %1, %2, %3 \n"
"mov %0, %0, lsr %4 \n"
"add %1, %0, %1, lsl %5 \n"
: "=r"(res_hi), "=r"(res_low)\
: "r"(op1), "r"(op2), "i"(CFX_Q), "i"(32-CFX_Q));
return (ClutterFixed) res_low;
#else
long long r = (long long) op1 * (long long) op2;
return (unsigned int)(r >> CFX_Q);
#endif
}
#endif
G_INLINE_FUNC
ClutterFixed clutter_qdivx (ClutterFixed op1, ClutterFixed clutter_qdivx (ClutterFixed op1,
ClutterFixed op2); ClutterFixed op2);
#if defined (G_CAN_INLINE)
G_INLINE_FUNC
ClutterFixed clutter_qdivx (ClutterFixed op1,
ClutterFixed op2)
{
return (ClutterFixed) ((((gint64) op1) << CFX_Q) / op2);
}
#endif
ClutterFixed clutter_sinx (ClutterFixed angle); ClutterFixed clutter_sinx (ClutterFixed angle);
ClutterFixed clutter_sini (ClutterAngle angle); ClutterFixed clutter_sini (ClutterAngle angle);