[issue4294] Macros for PyLong: sign, number of digits, fits in an int
STINNER Victor
report at bugs.python.org
Mon Nov 10 15:00:37 CET 2008
STINNER Victor <victor.stinner at haypocalc.com> added the comment:
> What's the purpose of your sdigit?
The type sdigit should be able to store a signed digit, so a number in
[-(2^15-1); 2^15-1]. short may be enough, but I think that the CPU
prefers (CPU is faster with) an int because it doesn't have to
truncate the MSB (eg. 32 bits (u)int => 16 bits (u)short). I also
used "int" because Python was already using "int" (right?)
> would probably be better off in longobject.h
Right.
> It's quite tempting to 'fix' _PyLong_AsScaledDouble to
> return e as the number of bits, rather than the number of digits
Good idea. But instead of writing a patch of 100.000 lines, I prefer
to start with a small patch and then add new patches to improve it. It
allows to apply only some patches but not all. Is
_PyLong_AsScaledDouble() used by another module than mathmodule.c?
> marshal.c
Same: it's better to write a separated patch.
--
I opened a new issue because the GMP and 30-bits patchs are too big
and it's not easy to review/commit them. The idea is to do small
changes to allow bigger changes later.
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4294>
_______________________________________
More information about the Python-bugs-list
mailing list