bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#42269: Remove non-GMP code from coreutils factor.c


From: Paul Eggert
Subject: bug#42269: Remove non-GMP code from coreutils factor.c
Date: Wed, 8 Jul 2020 09:25:57 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0

I recently modified GNU coreutils so that it can assume GMP, possibly by compiling and linking mini-gmp.c. This helps simplify the coreutils source code and makes coreutils behavior more portable.

In doing so, I noticed that factor.c has special-purpose code to factor integers up to 127 bits. Although this code added functionality when coreutils could not assume GMP, it's no longer needed for that. And although it runs faster than the GMP code does, while doing the recent surgery on factor.c I began to wonder whether the hassle of maintaining the code outweighed its usefulness. So I wrote up the attached patch, which simply removes the non-GMP code and simplifies factor.c quite a bit.

I assume the attached patch will hurt performance significantly in some cases for 127-bit numbers, so I did not install it. Perhaps it would be better to keep the non-GMP algorithm and recode it with GMP. Or perhaps it would be better to leave the factor.c code alone.

Comments?

Attachment: 0001-factor-simplify-by-assuming-libgmp.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]