gst/gstutils.c: Optimisations, remove unneeded vars.
authorWim Taymans <wim.taymans@gmail.com>
Fri, 25 Nov 2005 11:38:38 +0000 (11:38 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Fri, 25 Nov 2005 11:38:38 +0000 (11:38 +0000)
Original commit message from CVS:
* gst/gstutils.c: (gst_util_uint64_scale_int64),
(gst_util_uint64_scale_int):
Optimisations, remove unneeded vars.

ChangeLog
gst/gstutils.c

index ab1fb89..149c8b4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2005-11-25  Wim Taymans  <wim@fluendo.com>
 
+       * gst/gstutils.c: (gst_util_uint64_scale_int64),
+       (gst_util_uint64_scale_int):
+       Optimisations, remove unneeded vars.
+
+2005-11-25  Wim Taymans  <wim@fluendo.com>
+
        * check/gst/gstutils.c: (GST_START_TEST), (gst_utils_suite):
        Added more checks for the high precision uint64 cases.
 
index 3a182c9..361684a 100644 (file)
@@ -504,24 +504,22 @@ gst_util_uint64_scale_int (guint64 val, gint num, gint denom)
     /* simple case */
     result.ll = val * num / denom;
   } else {
-    GstUInt64 gval, low, high, temp;
+    GstUInt64 low, high;
 
     /* do 96 bits mult/div */
-    gval.ll = val;
-    low.ll = ((guint64) gval.l.low) * num;
-    high.ll = ((guint64) gval.l.high) * num + (low.l.high);
-    result.ll = (high.ll / denom);
-    temp.l.high = (high.ll % denom);
-    temp.l.low = (low.l.low);
-    temp.ll /= denom;
+    low.ll = val;
+    result.ll = ((guint64) low.l.low) * num;
+    high.ll = ((guint64) low.l.high) * num + (result.l.high);
+
+    low.ll = high.ll / denom;
+    result.l.high = high.ll % denom;
+    result.ll /= denom;
 
     /* avoid overflow */
-    if (result.ll + temp.l.high > G_MAXUINT32)
+    if (low.ll + result.l.high > G_MAXUINT32)
       goto overflow;
 
-    result.l.high = result.l.low;
-    result.l.low = 0;
-    result.ll += temp.ll;
+    result.l.high += low.l.low;
   }
   return result.ll;