PATCH 21.5
I did not intend to take this long, or produce such a large patch, but it kind
of got away from me. This patch started life as an effort to fix the problem
that C integers larger than a machine word are not converted to bignums
properly. Then as I stumbled across various bugs and problems, it grew into a
larger cleanup of some of the bignum code. Here is what this patch now does:
- Uses make_fixnum instead of make_integer when the argument is guaranteed to
be in the fixnum range.
- Introduces make_unsigned_integer so that we handle unsigned values with the
high bit set correctly.
- Introduces conversions between bignums and (un)signed long long values.
- Uses mp_set_memory_functions with the BSD MP code, if it exists.
- Eliminates all use of move()/mp_move(). For one thing, we had a check in
configure to see if the function is even available. Presumably there are,
or were, MP implementations without this function. But then we did nothing
if the function didn't exist and just used it anyway. For another thing,
the move() compatibility function in GMP 5.0.5 (which is what I have on my
Fedora 18 workstation) is broken. Sometimes it works as expected, sometimes
I get zero in the target bignum, even though the source bignum had a nonzero
value. I took the drastic step of wiping out all uses of this function just
so I could do some testing. (Note that the BSD compatibility functions were
dropped from GMP 5.1, so once I upgrade to Fedora 19, I won't be able to
test this code any more.)
- Eliminates some unnecessary consing in the Lisp + and * implementations.
- Fixes a problem with check_valid_xbm_inline(). This function is called
during intialization. It calls Ftimes. When using pdump, this is a
problem, because (a) the bignum code is not initialized until *after*
dumping, so we don't try to dump any bignums, and (b) multiplication of
integers is done inside bignums so we handle fixnum overflow correctly. I
decided that an XBM file with dimensions that don't fit into fixnums is
probably not something we want to try to handle anyway, and did the
arithmetic with C values instead of Lisp values. Doing that broke one test,
which started getting a different error message from the one it expected, so
I adjusted the test to match the new reality.
- Fixes a few miscellaneous bugs in the BSD MP code.
The patch is attached to avoid whitespace mangling courtesy of gmail.
--
Jerry James
http://www.jamezone.org/
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches