gst/gstutils.c: Chain trivial case to _scale_int.

Original commit message from CVS:
* gst/gstutils.c: (gst_util_uint64_scale),
(gst_util_uint64_scale_int):
Chain trivial case to _scale_int.
This commit is contained in:
Wim Taymans 2005-11-24 18:03:15 +00:00
parent fbf5f16d69
commit 6ceca6153b
2 changed files with 19 additions and 3 deletions

View file

@ -1,3 +1,9 @@
2005-11-24 Wim Taymans <wim@fluendo.com>
* gst/gstutils.c: (gst_util_uint64_scale),
(gst_util_uint64_scale_int):
Chain trivial case to _scale_int.
2005-11-24 Wim Taymans <wim@fluendo.com>
* check/gst/gstutils.c: (GST_START_TEST), (gst_utils_suite):

View file

@ -369,9 +369,19 @@ typedef union
guint64
gst_util_uint64_scale (guint64 val, guint64 num, guint64 denom)
{
guint64 result;
g_return_val_if_fail (denom != 0, G_MAXUINT64);
if (num <= G_MAXINT32 && denom <= G_MAXINT32) {
result = gst_util_uint64_scale_int (val, (gint) num, (gint) denom);
} else {
/* implement me with fixed point, if you care */
return gst_gdouble_to_guint64 (gst_guint64_to_gdouble (val) *
result = gst_gdouble_to_guint64 (gst_guint64_to_gdouble (val) *
((gst_guint64_to_gdouble (num)) / gst_guint64_to_gdouble (denom)));
}
return result;
}
/**