[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Using the GNU GMP Library for Bignums in Emacs
From: |
Tom Tromey |
Subject: |
Re: Using the GNU GMP Library for Bignums in Emacs |
Date: |
Sat, 07 Jul 2018 00:20:47 -0600 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.1.50 (gnu/linux) |
>> #define lisp_h_CHECK_FIXNUM(x) CHECK_TYPE (FIXNUMP (x), Qintegerp, x)
Paul> That last line should use Qfixnump, surely.
The reason I hesitated is that it seems possible for some Lisp code to
notice this change.
This is also why I wasn't sure that intbig_to_lisp et al should be
converted. (This one seems even a little worse since it'll be possible
to build without GMP.)
>> sed -i 's/INTEGERP/FIXNUMP/g' *.[ch]
Paul> I doubt whether this is the best option. Often, the code should
Paul> actually be checking for integers, not for fixnums. So the existing
Paul> code needs to be examined more carefully, with only some INTEGERP
Paul> instances changed to FIXNUMP. (Code should prefer INTEGERP to FIXNUMP,
Paul> for generality, but in some cases FIXNUMP will have to do.)
I probably should have explained a little more.
The basic idea behind the patch series is to do the conversion
incrementally. So, the first patch is just these sed-based renamings --
the resulting Emacs works the same.
Next comes the configury; then the bignum type and type predicate.
After this come some patches to change various operations: eql,
comparisons, arithmetic, printing, the reader, Ffloat, ...
Some of these subsequent patches introduce things like the new INTEGERP:
INLINE bool
INTEGERP (Lisp_Object x)
{
return FIXNUMP (x) || BIGNUMP (x);
}
... or the new make_number, etc.
So, the examination you want is done, just not all in a single patch. I
think this will make review simpler for whoever does that. Also this
avoids having to convert absolutely everything, which I am sure I can't
do alone.
It's not all so clean right now, so if you do happen to look the
patches, don't be worried, I plan to rework the whole series to be
cleaner before submitting it.
I made a few more things work tonight. My "minimal viable feature"
to-do list is down to:
* documentation
* natnump
* since we can't have small bignums we can simplify eql a bit
* logcount
* check how rounding should be done for division and fix the code
* lsh / ash
* logb
* % and mod
Any ideas on things that might be missing from this list?
I wonder if Emacs should (provide 'bignum) when bignums are compiled in.
I still haven't looked at using the mpn_ API.
Tom
- Re: Using the GNU GMP Library for Bignums in Emacs, Tom Tromey, 2018/07/05
- Re: Using the GNU GMP Library for Bignums in Emacs, John Wiegley, 2018/07/05
- Re: Using the GNU GMP Library for Bignums in Emacs, Tom Tromey, 2018/07/06
- Re: Using the GNU GMP Library for Bignums in Emacs, Paul Eggert, 2018/07/06
- Re: Using the GNU GMP Library for Bignums in Emacs, Tom Tromey, 2018/07/07
- Re: Using the GNU GMP Library for Bignums in Emacs, Paul Eggert, 2018/07/07
- Re: Using the GNU GMP Library for Bignums in Emacs,
Tom Tromey <=
- Re: Using the GNU GMP Library for Bignums in Emacs, Paul Eggert, 2018/07/07
- Re: Using the GNU GMP Library for Bignums in Emacs, Tom Tromey, 2018/07/09
- Re: Using the GNU GMP Library for Bignums in Emacs, Paul Eggert, 2018/07/09
- Re: Using the GNU GMP Library for Bignums in Emacs, Tom Tromey, 2018/07/09
- Re: Using the GNU GMP Library for Bignums in Emacs, Paul Eggert, 2018/07/09
- Re: Using the GNU GMP Library for Bignums in Emacs, Tom Tromey, 2018/07/09
- Re: Using the GNU GMP Library for Bignums in Emacs, Tom Tromey, 2018/07/10
- Re: Using the GNU GMP Library for Bignums in Emacs, Tom Tromey, 2018/07/10
- Re: Using the GNU GMP Library for Bignums in Emacs, Tom Tromey, 2018/07/08
- Re: Using the GNU GMP Library for Bignums in Emacs, Tom Tromey, 2018/07/09