]> git.ipfire.org Git - thirdparty/coreutils.git/commit
factor: simplify primes table
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 9 Jul 2025 16:48:21 +0000 (09:48 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 10 Jul 2025 00:12:40 +0000 (17:12 -0700)
commit035b837146ec972d2a0603d6429727863f9b6a41
treee1a526dde76e7e407e852b2a0903d3f39049a703
parentb754d14117c8773ad5330bc488eac92900f5ac25
factor: simplify primes table

* src/factor.c (primes_ptab): New table of primes, replacing
primes_diff and primes_diff8.  All uses changed.  This is simpler
and should improve performance slightly.  Although this limits the
table’s primes to 2**15 instead of to 668221, the limit can easily
grow to 2**32 by changing the type of ‘prime’, without hurting
performance significantly compared to the primes_diff and
primes_diff8 approach.
* src/make-prime-list.c (output_primes):
For each prime p, output p instead of two differences.
src/factor.c
src/make-prime-list.c