]> git.sesse.net Git - vlc/commitdiff
Re-implement GCD iteratively. Fix unused function warning.
authorRémi Denis-Courmont <rem@videolan.org>
Sat, 5 Jan 2008 13:29:01 +0000 (13:29 +0000)
committerRémi Denis-Courmont <rem@videolan.org>
Sat, 5 Jan 2008 13:29:01 +0000 (13:29 +0000)
include/vlc_common.h

index fa177d538b10e420380444c2815ed5cfe46740be..a467273876def2093cc448c4daa46fe6a461d6aa 100644 (file)
@@ -670,10 +670,15 @@ __vlc_gc_init( gc_object_t * p_gc, void (*pf_destructor)( gc_object_t * ),
 #   define __MIN(a, b)   ( ((a) < (b)) ? (a) : (b) )
 #endif
 
-static int64_t GCD( int64_t a, int64_t b )
+static inline int64_t GCD( int64_t a, int64_t b )
 {
-    if( b ) return GCD( b, a % b );
-    else return a;
+    while( b )
+    {
+        int64_t c = a % b;
+        a = b;
+        b = c;
+    }
+    return a;
 }
 
 /* function imported from libavutil/common.h */