# HG changeset patch # User Santeri Piippo # Date 1404096794 -10800 # Node ID cee9f0ecac66ea31567c10eca6ec28a70a53d0ac # Parent 9adb822de7b9deec20a892eb8a812a45d8057122 - optimized simplify() diff -r 9adb822de7b9 -r cee9f0ecac66 src/miscallenous.cc --- a/src/miscallenous.cc Mon Jun 30 05:52:10 2014 +0300 +++ b/src/miscallenous.cc Mon Jun 30 05:53:14 2014 +0300 @@ -146,12 +146,12 @@ { repeat = false; - for (int x = 0; x < NUM_PRIMES; x++) + for (int x = 0; x < countof (primes); x++) { - const int prime = g_primes[NUM_PRIMES - x - 1]; + int const prime = primes[x]; - if (numer <= prime || denom <= prime) - continue; + if (numer < prime && denom < prime) + break; if ((numer % prime == 0) && (denom % prime == 0)) { @@ -161,8 +161,7 @@ break; } } - } - while (repeat); + } while (repeat); } // =============================================================================