[issue4294] Macros for PyLong: sign, number of digits, fits in an int

Mark Dickinson report at bugs.python.org
Sun Mar 22 11:42:03 CET 2009


Mark Dickinson <dickinsm at gmail.com> added the comment:

A few comments:

I think PyLong_SIGN and PyLong_EQUALS_ZERO should go in 
Include/longobject.h, not Include/longintrepr.h:  these 2 macros have an 
unambiguous meaning for *any* representation of integers.  And 
longintrepr.h is really supposed to be private, for the use of 
longobject.c only.  PyLong_NDIGITS should stay in longintrepr.h, though, 
since it's dependent on the representation.

Perhaps rename PyLong_EQUALS_ZERO to PyLong_IS_ZERO?

Almost all your uses of PyLong_SIGN take the form PyLong_SIGN(X) < 0.  
Maybe it would be better to have a PyLong_IS_NEGATIVE macro instead?

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4294>
_______________________________________


More information about the Python-bugs-list mailing list