[vlc-devel] commit: Re-implement GCD iteratively. Fix unused function warning. ( Rémi Denis-Courmont )
git version control
git at videolan.org
Fri Mar 28 16:07:02 CET 2008
vlc | branch: 0.8.6-bugfix | Rémi Denis-Courmont <rem at videolan.org> | Sat Jan 5 13:29:01 2008 +0000| [157d370a1dd722d7773ff5aac43d476aa74d3224]
Re-implement GCD iteratively. Fix unused function warning.
(cherry picked from commit d6271bf00c0c4e1636959b303a497d86816f70f2)
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=157d370a1dd722d7773ff5aac43d476aa74d3224
---
include/vlc_common.h | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/include/vlc_common.h b/include/vlc_common.h
index 47038af..5160c2d 100644
--- a/include/vlc_common.h
+++ b/include/vlc_common.h
@@ -550,10 +550,15 @@ typedef int ( * vlc_callback_t ) ( vlc_object_t *, /* variable's object */
# 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;
}
/* Dynamic array handling: realloc array, move data, increment position */
More information about the vlc-devel
mailing list