Commit 7319b52a authored by Vincent Penquerc'h's avatar Vincent Penquerc'h

gstutils: add a 64 bit version of GCD calculation

https://bugzilla.gnome.org/show_bug.cgi?id=665294
parent b6abb979
......@@ -3521,6 +3521,32 @@ gst_util_greatest_common_divisor (gint a, gint b)
return ABS (a);
}
/**
* gst_util_greatest_common_divisor_int64:
* @a: First value as #gint64
* @b: Second value as #gint64
*
* Calculates the greatest common divisor of @a
* and @b.
*
* Returns: Greatest common divisor of @a and @b
*
* Since: 0.11.0
*/
gint64
gst_util_greatest_common_divisor_int64 (gint64 a, gint64 b)
{
while (b != 0) {
gint64 temp = a;
a = b;
b = temp % b;
}
return ABS (a);
}
/**
* gst_util_fraction_to_double:
* @src_n: Fraction numerator as #gint
......
......@@ -957,6 +957,7 @@ gpointer gst_util_array_binary_search (gpointer array, guint num_eleme
/* fraction operations */
gint gst_util_greatest_common_divisor (gint a, gint b);
gint64 gst_util_greatest_common_divisor_int64 (gint64 a, gint64 b);
void gst_util_fraction_to_double (gint src_n, gint src_d, gdouble *dest);
void gst_util_double_to_fraction (gdouble src, gint *dest_n, gint *dest_d);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment