From cf59d114bea42ea9524cc23f5cc70bc881e701e3 Mon Sep 17 00:00:00 2001 From: jtc Date: Fri, 5 Nov 2004 15:59:05 +0000 Subject: ChangeLogTag: Fri Nov 5 07:52:51 2004 J.T. Conklin --- ChangeLog | 9 +++++++++ ace/ACE.cpp | 12 ++++++------ 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 + + * 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 * 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; } -- cgit v1.2.1