changeset 19883:4e43ba6844d8

Fix stupid use of multiplication to check signs which fails because of overflow. Negative values do not seem to be used so just remove the failing test.
author uau
date Mon, 18 Sep 2006 14:04:50 +0000
parents 9ffae26c0add
children 7725b85ada9f
files libaf/af.c
diffstat 1 files changed, 1 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/libaf/af.c	Mon Sep 18 13:00:51 2006 +0000
+++ b/libaf/af.c	Mon Sep 18 14:04:50 2006 +0000
@@ -650,11 +650,9 @@
  * \brief calculate greatest common divisior of a and b.
  * \ingroup af_filter
  *
- *   Extended for negative and 0 values. If both are 0 the result is 1.
- *   The sign of the result will be so that it has the same sign as b.
+ *   If both are 0 the result is 1.
  */
 int af_gcd(register int a, register int b) {
-  int b_org = b;
   while (b != 0) {
     a %= b;
     if (a == 0)
@@ -665,8 +663,6 @@
   a += b;
   if (!a)
     return 1;
-  if (a * b_org < 0)
-    return -a;
   return a;
 }