From e833356561417a913f0bc0873200e141b6312adc Mon Sep 17 00:00:00 2001 From: Tomas Frydrych Date: Fri, 18 Jan 2008 12:17:41 +0000 Subject: [PATCH] 2007-01-18 Tomas Frydrych * clutter/clutter-fixed.h: * clutter/clutter-fixed.c: Added CLUTTER_QDIV() for 64-bit division (bug 564, patch by Gwenole Beauchesne). --- ChangeLog | 13 ++++++++++--- clutter/clutter-fixed.c | 18 ++++++++++++++++++ clutter/clutter-fixed.h | 1 + 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index d17870e..7ea0f1b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-01-18 Tomas Frydrych + + * 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 * clutter/clutter-event.h: Add a gunichar field for the Unicode @@ -39,7 +46,7 @@ * clutter/clutter-effect.h: * clutter/clutter-effect.c (clutter_effect_scale): Split the final scale factor to match the ClutterBehaviourScale changes. (#709) - + * tests/test-actors.c: * tests/test-effects.c: * tests/test-rotate.c: @@ -190,7 +197,7 @@ * clutter/clutter-model.c: (clutter_model_appendv), (clutter_model_prependv): Add vector based API for bindings. - + (clutter_model_get_column_name), (clutter_model_get_column_type), (clutter_model_set_sorting_column): Fix the check in the condition @@ -203,7 +210,7 @@ 2008-01-04 Emmanuele Bassi * clutter.symbols: Add clutter_actor_move_byu() - + * clutter/clutter-actor.h: * clutter/clutter-actor.c: (clutter_actor_move_by), diff --git a/clutter/clutter-fixed.c b/clutter/clutter-fixed.c index 891dc1a..f978325 100644 --- a/clutter/clutter-fixed.c +++ b/clutter/clutter-fixed.c @@ -741,6 +741,24 @@ clutter_qmulx (ClutterFixed op1, ClutterFixed op2) #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 diff --git a/clutter/clutter-fixed.h b/clutter/clutter-fixed.h index 7433b4e..912395b 100644 --- a/clutter/clutter-fixed.h +++ b/clutter/clutter-fixed.h @@ -274,6 +274,7 @@ typedef gint32 ClutterAngle; /* angle such that 1024 == 2*PI */ #define CFX_MUL CLUTTER_FIXED_MUL #define CFX_DIV CLUTTER_FIXED_DIV #define CFX_QMUL(x,y) clutter_qmulx (x,y) +#define CFX_QDIV(x,y) clutter_qdivx (x,y) /*< public >*/ /* Fixed point math routines */ -- 2.7.4