Skip to content

Commit 3871436

Browse files
Micro optimization
1 parent 799ea27 commit 3871436

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

FindAFactor/_find_a_factor.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -829,9 +829,8 @@ struct Factorizer {
829829
// Compute the prime factorization modulo 2
830830
boost::dynamic_bitset<size_t> factorizationVector(BigInteger num) {
831831
boost::dynamic_bitset<size_t> vec(primes.size(), false);
832-
BigInteger factor = 1U;
833-
do {
834-
factor = gcd(num, wheelRadius);
832+
while (true) {
833+
BigInteger factor = gcd(num, wheelRadius);
835834
if (factor == 1U) {
836835
break;
837836
}
@@ -852,7 +851,7 @@ struct Factorizer {
852851
}
853852
// Since we removed smooth primes,
854853
// factor == 1U if the number is smooth.
855-
} while (factor == 1U);
854+
};
856855

857856
if (num != 1U) {
858857
return boost::dynamic_bitset<size_t>();

0 commit comments

Comments
 (0)