From 7de609028ca2cec45b61e277290af1ddbadaf87b Mon Sep 17 00:00:00 2001 From: Romain Goyet Date: Tue, 10 Apr 2018 15:03:42 +0200 Subject: [PATCH] [poincare] Don't make Integer::k_primorial32 a global variable --- poincare/include/poincare/arithmetic.h | 1 - poincare/src/arithmetic.cpp | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/poincare/include/poincare/arithmetic.h b/poincare/include/poincare/arithmetic.h index 82e7a99c3..fd93804f4 100644 --- a/poincare/include/poincare/arithmetic.h +++ b/poincare/include/poincare/arithmetic.h @@ -13,7 +13,6 @@ public: static void PrimeFactorization(const Integer * i, Integer * outputFactors, Integer * outputCoefficients, int outputLength); constexpr static int k_numberOfPrimeFactors = 1000; constexpr static int k_maxNumberOfPrimeFactors = 32; - static const Integer k_primorial32; private: /* When decomposing an integer into primes factors, we look for its prime * factors among integer from 2 to 10000. */ diff --git a/poincare/src/arithmetic.cpp b/poincare/src/arithmetic.cpp index a476cc957..3181a5ccc 100644 --- a/poincare/src/arithmetic.cpp +++ b/poincare/src/arithmetic.cpp @@ -3,8 +3,6 @@ namespace Poincare { -const Integer Arithmetic::k_primorial32("525896479052627740771371797072411912900610967452630"); - Integer Arithmetic::LCM(const Integer * a, const Integer * b) { if (a->isZero() || b->isZero()) { return Integer(0); @@ -47,7 +45,8 @@ void Arithmetic::PrimeFactorization(const Integer * n, Integer * outputFactors, if (m.isEqualTo(Integer(1))) { return; } - if (k_primorial32.isLowerThan(m)) { + const Integer primorial32("525896479052627740771371797072411912900610967452630"); + if (primorial32.isLowerThan(m)) { /* Special case 1: We do not want to break i in prime factor because it * might take too many factors... More than k_maxNumberOfPrimeFactors. * outputCoefficients[0] is set to -1 to indicate a special case. */