]> git.ipfire.org Git - thirdparty/coreutils.git/commit
factor: use same word size as GMP
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 1 Jun 2025 23:02:21 +0000 (16:02 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 10 Jul 2025 00:12:39 +0000 (17:12 -0700)
commitd6ee61e407b0cfd6252a1b0bea3aef4d887dba5f
tree7e77650e3602f4342dc174bd9dca7575b830d711
parentc8af57b5b83bf7af7ff4c1a9aa1b4ae68b83f741
factor: use same word size as GMP

Remove experimental code for 128-bit words as it does not work and
we lack time to figure out why.  Instead, ensure that words are
the same size as with GMP.
* src/factor.c (USE_INT128): Remove.  All uses removed.
(wide_uint, W_TYPE_SIZE): Define to be the same as GMP.
(MP_LIMB_MAX): New macro.  Check that it matches W_TYPE_SIZE.
(USE_LONGLONG_H): Default to true.
(UHWtype) [USE_LONGLONG_H]: Define to unsigned int, same as GMP.
(prime_p): Go back to not worrying about 128-bit words,
since GMP doesn’t worry and doesn’t use them.
(lbuf_putbitcnt): New function, since we cannot assume
that bitcnt_t fits into mp_limb_t.
(print_factors): Use it.
* src/make-prime-list.c (output_primes):
Don’t assume that wide_uint’s maximum is UINTMAX_MAX.
src/factor.c
src/make-prime-list.c