]> git.ipfire.org Git - thirdparty/coreutils.git/commit
factor: refactor to allow non-uintmax_t ints
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 18 May 2025 04:42:37 +0000 (21:42 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sun, 18 May 2025 04:49:22 +0000 (21:49 -0700)
commitc4fdbd95bd27a23abff81d6fdc434917b396b497
tree1b774ebf4c537e2f23322307184f59ca270f37e5
parent3844c15934ed232241558f4181163d11739edc4c
factor: refactor to allow non-uintmax_t ints

This prepares for using unsigned __int128 instead of uintmax_t.
It doesn’t change behavior.
* src/factor.c (wide_uint, wide_int):
New typedefs, replacing all uses of uintmax_t, intmax_t.
(WIDE_UINT_MAX): New macro, replacing all uses of UINTMAX_MAX.
(USE_LONGLONG_H): Don’t use LONG_MAX and INTMAX_MAX (which
should have been ULONG_MAX and UINTMAX_MAX anyway).
Instead, use W_TYPE_SIZE and ULONG_WIDTH, as that will be
easier to work with if we use unsigned __int128.
(binv): Also unroll for the 128-bit case.
* src/make-prime-list.c (print_wide_uint):
Print "wide_uint" not "uintmax_t".
src/factor.c
src/make-prime-list.c