From: Rémi Denis-Courmont Date: Sat, 5 Jan 2008 13:29:01 +0000 (+0000) Subject: Re-implement GCD iteratively. Fix unused function warning. X-Git-Tag: 0.9.0-test0~3642 X-Git-Url: https://git.videolan.org/gitweb.cgi/vlc.git/?p=vlc.git;p=vlc.git;a=commitdiff_plain;h=d6271bf00c0c4e1636959b303a497d86816f70f2;ds=sidebyside Re-implement GCD iteratively. Fix unused function warning. --- diff --git a/include/vlc_common.h b/include/vlc_common.h index fa177d538b..a467273876 100644 --- a/include/vlc_common.h +++ b/include/vlc_common.h @@ -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 */