https://gmplib.org/manual/Low_002dlevel-Functions
Says the result can be up to the smaller operand.
There's no compatibility notes and the interface seems stable
for at least 10 years.
Also in the following SBCL version, we have:
(rl (if (< xl yl) xl yl))
(res (sb-bignum::%allocate-bignum rl)))
- Qian
On 10/18/24 6:35 AM, Waldek Hebisch wrote:
On Thu, Oct 17, 2024 at 08:42:21PM +0800, Qian Yun wrote:
BTW, why use addition for "rlb"? The result of gcd
will always be smaller than the arguments.
The following will save a few bytes on stack allocation.
- Qian
diff --git a/src/lisp/num_gmp.lisp b/src/lisp/num_gmp.lisp
index f9015a2b..debcb796 100644
--- a/src/lisp/num_gmp.lisp
+++ b/src/lisp/num_gmp.lisp
@@ -462,7 +462,7 @@
(rl (if (< xl yl) xl yl))
(xlb (words_to_bytes xl))
(ylb (words_to_bytes yl))
- (rlb (+ xlb ylb))
+ (rlb (if (< xlb ylb) xlb ylb))
)
(declare (type fixnum xl yl rl xlb ylb rlb))
I do not remember why. But gmp have its requirements, so before
going with such a change one should check what gmp requires.
Note that violating gmp requirements may work for one gmp
version and fail for different version.
--
You received this message because you are subscribed to the Google Groups "FriCAS -
computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/fricas-devel/cda955d5-0c3d-48b1-8e5b-463f6cf7d19e%40gmail.com.