From 307fee457a7951ed0ba15be4c7038a939ac66926 Mon Sep 17 00:00:00 2001 From: John Maddock Date: Sat, 6 Oct 2007 11:12:33 +0000 Subject: [PATCH] Fix Borland infinite looping issue. [SVN r39723] --- include/boost/math/common_factor_rt.hpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/boost/math/common_factor_rt.hpp b/include/boost/math/common_factor_rt.hpp index c02d12a..6200b96 100644 --- a/include/boost/math/common_factor_rt.hpp +++ b/include/boost/math/common_factor_rt.hpp @@ -15,6 +15,7 @@ #include // for BOOST_NESTED_TEMPLATE, etc. #include // for std::numeric_limits +#include namespace boost @@ -142,11 +143,18 @@ namespace detail // Whittle down the values via their differences do { +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582)) + while ( !(r[ which ] & 1u) ) + { + r[ which ] = (r[which] >> 1); + } +#else // Remove factors of two from the even one while ( !(r[ which ] & 1u) ) { r[ which ] >>= 1; } +#endif // Replace the larger of the two with their difference if ( r[!which] > r[which] )