]> git.sesse.net Git - vlc/commitdiff
We only have to reduce unsigned fractions in VLC
authorRémi Denis-Courmont <rem@videolan.org>
Sun, 10 Jul 2005 09:13:20 +0000 (09:13 +0000)
committerRémi Denis-Courmont <rem@videolan.org>
Sun, 10 Jul 2005 09:13:20 +0000 (09:13 +0000)
(someone show me a screen with a negative pixel resolution)

include/vlc_common.h
include/vlc_symbols.h
src/extras/libc.c

index 5ccecc11ca44d6b57c354ea1a6942ef33b5fe78d..c370923eb9d384942e5584c22bc539fd1376f785 100644 (file)
@@ -998,7 +998,7 @@ typedef __int64 off_t;
 #   include <tchar.h>
 #endif
 
-VLC_EXPORT( vlc_bool_t, vlc_reduce, ( int *, int *, int64_t, int64_t, int64_t ) );
+VLC_EXPORT( vlc_bool_t, vlc_reduce, ( unsigned *, unsigned *, uint64_t, uint64_t, uint64_t ) );
 VLC_EXPORT( char **, vlc_parse_cmdline, ( const char *, int * ) );
 
 /* vlc_wraptext (defined in src/extras/libc.c) */
index 3a898e944cc9f96344ed82680e64f5001bbbe35a..4af77d556d8199a951ac7a421c4004284b3e067a 100644 (file)
@@ -181,7 +181,7 @@ struct module_symbols_t
     void * (*vlc_opendir_inner) (const char *);
     void * (*vlc_readdir_inner) (void *);
     int (*vlc_closedir_inner) (void *);
-    vlc_bool_t (*vlc_reduce_inner) (int *, int *, int64_t, int64_t, int64_t);
+    vlc_bool_t (*vlc_reduce_inner) (unsigned *, unsigned *, uint64_t, uint64_t, uint64_t);
     char ** (*vlc_parse_cmdline_inner) (const char *, int *);
     char * (*vlc_wraptext_inner) (const char *, int, vlc_bool_t);
     vlc_iconv_t (*vlc_iconv_open_inner) (const char *, const char *);
index 06d5e27425872431743f7c3b653b28fae5b986cf..c51fac7d2a2c3c4686ad8d14e07d6a8c2310b42c 100644 (file)
@@ -463,11 +463,11 @@ int vlc_iconv_close( vlc_iconv_t cd )
  * reduce a fraction
  *   (adapted from libavcodec, author Michael Niedermayer <michaelni@gmx.at>)
  *****************************************************************************/
-vlc_bool_t vlc_reduce( int *pi_dst_nom, int *pi_dst_den,
-                       int64_t i_nom, int64_t i_den, int64_t i_max )
+vlc_bool_t vlc_reduce( unsigned *pi_dst_nom, unsigned *pi_dst_den,
+                       uint64_t i_nom, uint64_t i_den, uint64_t i_max )
 {
-    vlc_bool_t b_exact = 1, b_sign = 0;
-    int64_t i_gcd;
+    vlc_bool_t b_exact = 1;
+    uint64_t u_gcd;
 
     if( i_den == 0 )
     {
@@ -476,18 +476,6 @@ vlc_bool_t vlc_reduce( int *pi_dst_nom, int *pi_dst_den,
         return 1;
     }
 
-    if( i_den < 0 )
-    {
-        i_den = - i_den;
-        i_nom = - i_nom;
-    }
-
-    if( i_nom < 0 )
-    {
-        i_nom = - i_nom;
-        b_sign = 1;
-    }
-
     i_gcd = GCD( i_nom, i_den );
     i_nom /= i_gcd;
     i_den /= i_gcd;
@@ -518,8 +506,6 @@ vlc_bool_t vlc_reduce( int *pi_dst_nom, int *pi_dst_den,
         i_den = i_a1_den;
     }
 
-    if( b_sign ) i_nom = - i_nom;
-
     *pi_dst_nom = i_nom;
     *pi_dst_den = i_den;