diff options
author | Sebastien Pouliot <sebastien@ximian.com> | 2004-05-07 15:10:01 +0400 |
---|---|---|
committer | Sebastien Pouliot <sebastien@ximian.com> | 2004-05-07 15:10:01 +0400 |
commit | 1e5e8d4172523fb4014ef7580572e94de13014fb (patch) | |
tree | fff3729deabccd3297f90ac051da668e89c398c0 /mcs/class/Mono.Security | |
parent | c5540d48c00c034069a4d6b4c3fbba81f6819b86 (diff) |
2005-05-07 Sebastien Pouliot <sebastien@ximian.com>
* SequentialSearchPrimeGeneratorBase.cs: Start the smallPrime vector at
10 (not 9) as 29 was just tested (more for correctness than speed gain).
svn path=/trunk/mcs/; revision=26902
Diffstat (limited to 'mcs/class/Mono.Security')
-rw-r--r-- | mcs/class/Mono.Security/Mono.Math.Prime.Generator/ChangeLog | 5 | ||||
-rw-r--r-- | mcs/class/Mono.Security/Mono.Math.Prime.Generator/SequentialSearchPrimeGeneratorBase.cs | 12 |
2 files changed, 12 insertions, 5 deletions
diff --git a/mcs/class/Mono.Security/Mono.Math.Prime.Generator/ChangeLog b/mcs/class/Mono.Security/Mono.Math.Prime.Generator/ChangeLog index a9cb3b6cc9f..3f6c8ca5b76 100644 --- a/mcs/class/Mono.Security/Mono.Math.Prime.Generator/ChangeLog +++ b/mcs/class/Mono.Security/Mono.Math.Prime.Generator/ChangeLog @@ -1,3 +1,8 @@ +2005-05-07 Sebastien Pouliot <sebastien@ximian.com> + + * SequentialSearchPrimeGeneratorBase.cs: Start the smallPrime vector at + 10 (not 9) as 29 was just tested (more for correctness than speed gain). + 2004-04-22 Sebastien Pouliot <sebastien@ximian.com> * NextPrimeFinder.cs: FxCop-ized. CLS compliance. diff --git a/mcs/class/Mono.Security/Mono.Math.Prime.Generator/SequentialSearchPrimeGeneratorBase.cs b/mcs/class/Mono.Security/Mono.Math.Prime.Generator/SequentialSearchPrimeGeneratorBase.cs index fb35199215e..8ba87836ba3 100644 --- a/mcs/class/Mono.Security/Mono.Math.Prime.Generator/SequentialSearchPrimeGeneratorBase.cs +++ b/mcs/class/Mono.Security/Mono.Math.Prime.Generator/SequentialSearchPrimeGeneratorBase.cs @@ -68,7 +68,7 @@ namespace Mono.Math.Prime.Generator { // // STEP 2.2 Sieve out all numbers divisible by the primes <= DivisionBound // - for (int p = 9; p < SmallPrimes.Length && SmallPrimes [p] <= DivisionBound; p++) { + for (int p = 10; p < SmallPrimes.Length && SmallPrimes [p] <= DivisionBound; p++) { if (curVal % SmallPrimes [p] == 0) goto biNotPrime; } @@ -76,20 +76,22 @@ namespace Mono.Math.Prime.Generator { // // STEP 2.3 Is the potential prime acceptable? // - if (!IsPrimeAcceptable (curVal, context)) goto biNotPrime; + if (!IsPrimeAcceptable (curVal, context)) + goto biNotPrime; // // STEP 2.4 Filter out all primes that pass this step with a primality test // - if (PrimalityTest (curVal, Confidence)) return curVal; - + if (PrimalityTest (curVal, Confidence)) + return curVal; // // STEP 2.4 // biNotPrime: pMod1 += 2; - if (pMod1 >= primeProd1) pMod1 -= primeProd1; + if (pMod1 >= primeProd1) + pMod1 -= primeProd1; curVal.Incr2 (); } } |