mpz_get_si: possible undefined behaviour? [Was: Micro-GMP]
tg at gmplib.org
Sun Dec 9 14:07:50 UTC 2018
"Marco Bodrato" <bodrato at mail.dm.unipi.it> writes:
Il Mer, 5 Dicembre 2018 1:55 pm, Torbjörn Granlund ha scritto:
> Let's follow these principles:
> 1. We don't need to support every past and present system. E.g., we
> do not support any 16-bit or 8-bit processors, nor do we support the
> once popular 36-bit systems.
I don't agree :-P
I mean: it would be nice to have a library that can pass all the tests of
our suite even if we include asl.h, wouldn't it?
Well... this means, more or less, to support 8-bit, 16-bit, and also
(because it's even simpler !-) 36-bit limb size; doesn't it?
Supporting unusual limb sizes through asl.h is not the same thing as
supporting unusual limb sizes without asl.h. Furthermore, I also had
systems using unusual representation of integers in mind.
It's not a priority, I agree, but... we should move towards that direction.
Generalising the library is good, unless it buys us nothing or unduly
increases the maintenance burden.
Aside from maintenance, I also don't consider untested code as working
code. If we e.g., "support" one's complement integers, then we make
some sort of claim that it works. But even if it works by chance one
happy day, it will surely break as times goes by.
But if you have a one's complement machine which could be used for
testing GMP, please run automated tests there!
In some code I recently wrote, I added some short-cuts
#if GMP_NUMB_BITS % 16 == 0
#if GMP_NUMB_BITS % 32 == 0
but the code is intended for any (not too small) bit size, why not?
That construct should be testable by means of asl.h.
Please encrypt, key id 0xC8601622
More information about the gmp-devel