summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--ace/ACE.cpp12
2 files changed, 15 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index baf831fcb2c..eb262e852ef 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+Fri Nov 5 07:52:51 2004 J.T. Conklin <jtc@acorntoolworks.com>
+
+ * ace/ACE.cpp:
+
+ Changed gcd() from recursive to iterative implementation.
+ A good optimizing compiler should be able to convert the
+ tail call to a jump; but some compilers aren't good, and
+ sometimes ACE is compiled without optimization.
+
Fri Nov 5 15:36:12 UTC 2004 Martin Corino <mcorino@remedy.nl>
* bin/MakeProjectCreator/templates/gnu.mpd:
diff --git a/ace/ACE.cpp b/ace/ACE.cpp
index 8ef9a2e7e7d..e7a1d0ece26 100644
--- a/ace/ACE.cpp
+++ b/ace/ACE.cpp
@@ -3022,14 +3022,14 @@ ACE::map_errno (int error)
u_long
ACE::gcd (u_long x, u_long y)
{
- if (y == 0)
+ while (y != 0)
{
- return x;
- }
- else
- {
- return ACE::gcd (y, x % y);
+ u_long r = x % y;
+ x = y;
+ y = r;
}
+
+ return x;
}