From: Bruno Haible Date: Tue, 19 Nov 2002 13:33:24 +0000 (+0000) Subject: Merge with gnulib. X-Git-Tag: v0.12~1207 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=813b61199d32c439b1424882cd1e58b251da4d87;p=thirdparty%2Fgettext.git Merge with gnulib. --- diff --git a/lib/ChangeLog b/lib/ChangeLog index d29b2b02a..d96051b4f 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,8 @@ +2002-11-06 Bruno Haible + + * gcd.h (gcd): Change argument type to 'unsigned long'. + * gcd.c (gcd): Likewise. + 2002-11-15 Bruno Haible * alloca.c: Update from current gnulib version. diff --git a/lib/gcd.c b/lib/gcd.c index 3a14e5012..b79087974 100644 --- a/lib/gcd.c +++ b/lib/gcd.c @@ -1,6 +1,6 @@ /* Arithmetic. Copyright (C) 2001-2002 Free Software Foundation, Inc. - Written by Bruno Haible , 2001. + Written by Bruno Haible , 2001. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,8 +22,8 @@ #include /* Return the greatest common divisor of a > 0 and b > 0. */ -unsigned int -gcd (unsigned int a, unsigned int b) +unsigned long +gcd (unsigned long a, unsigned long b) { /* Why no division, as in Euclid's algorithm? Because in Euclid's algorithm the division result floor(a/b) or floor(b/a) is very often = 1 or = 2, @@ -33,7 +33,7 @@ gcd (unsigned int a, unsigned int b) bit in a single instruction, and the algorithm uses fewer variables than Euclid's algorithm. */ - unsigned int c = a | b; + unsigned long c = a | b; c = c ^ (c - 1); /* c = largest power of 2 that divides a and b. */ diff --git a/lib/gcd.h b/lib/gcd.h index 6be393383..39ea5ed8d 100644 --- a/lib/gcd.h +++ b/lib/gcd.h @@ -1,6 +1,6 @@ /* Arithmetic. Copyright (C) 2001-2002 Free Software Foundation, Inc. - Written by Bruno Haible , 2001. + Written by Bruno Haible , 2001. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,6 +20,6 @@ #define _GCD_H /* Return the greatest common divisor of a > 0 and b > 0. */ -extern unsigned int gcd (unsigned int a, unsigned int b); +extern unsigned long gcd (unsigned long a, unsigned long b); #endif /* _GCD_H */