2007-01-18 Tomas Frydrych <tf@openedhand.com>

* clutter/clutter-fixed.h:
	* clutter/clutter-fixed.c:
	Added CLUTTER_QDIV() for 64-bit division (bug 564, patch by
	Gwenole Beauchesne).
This commit is contained in:
Tomas Frydrych 2008-01-18 12:17:41 +00:00
parent a68067b06c
commit e833356561
3 changed files with 29 additions and 3 deletions

View File

@ -1,3 +1,10 @@
2007-01-18 Tomas Frydrych <tf@openedhand.com>
* clutter/clutter-fixed.h:
* clutter/clutter-fixed.c:
Added CLUTTER_QDIV() for 64-bit division (bug 564, patch by
Gwenole Beauchesne).
2008-01-18 Emmanuele Bassi <ebassi@openedhand.com> 2008-01-18 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-event.h: Add a gunichar field for the Unicode * clutter/clutter-event.h: Add a gunichar field for the Unicode

View File

@ -741,6 +741,24 @@ clutter_qmulx (ClutterFixed op1, ClutterFixed op2)
#endif #endif
} }
/**
* clutter_fixed_qdivx:
* @op1: #ClutterFixed
* @op2: #ClutterFixed
*
* Return value: #ClutterFixed.
*
* Divides two fixed values using 64bit arithmetic; this provides
* significantly better precission than the #CLUTTER_FIXED_DIV macro,
* but at performance cost.
*
* Since: 0.4
*/
ClutterFixed
clutter_qdivx (ClutterFixed op1, ClutterFixed op2)
{
return (ClutterFixed)((((gint64)op1) << CFX_Q) / op2);
}
/* /*
* The log2x() and pow2x() functions * The log2x() and pow2x() functions

View File

@ -274,6 +274,7 @@ typedef gint32 ClutterAngle; /* angle such that 1024 == 2*PI */
#define CFX_MUL CLUTTER_FIXED_MUL #define CFX_MUL CLUTTER_FIXED_MUL
#define CFX_DIV CLUTTER_FIXED_DIV #define CFX_DIV CLUTTER_FIXED_DIV
#define CFX_QMUL(x,y) clutter_qmulx (x,y) #define CFX_QMUL(x,y) clutter_qmulx (x,y)
#define CFX_QDIV(x,y) clutter_qdivx (x,y)
/*< public >*/ /*< public >*/
/* Fixed point math routines */ /* Fixed point math routines */