Mark Dickinson <[EMAIL PROTECTED]> added the comment: It looks as though changing PyLong_SHIFT to 30 everywhere is much simpler than I feared. Here's a short patch that does exactly that. It:
- changes the definitions in longintrepr.h - changes marshal.c to write digits as longs, not shorts - adds some casts to longobject.c (most of which should really have been there already---clearly Python's never encountered a machine where ints are only 2 bytes long, even though the standard seems to permit it). With this patch, all tests pass on my machine with the exception of the getsizeof tests in test_sys; and sys.getsizeof is working fine---it's the tests that need to be changed. Still to do: - use uint64 and uint32 instead of unsigned long long and unsigned long, when available; this avoids wasting lots of space on platforms where a long is 64 bits. - provide fallback definitions for platforms that don't have any 64-bit type available - (?)expose the value of PyLong_SHIFT to Python somewhere (in sys?); then the getsizeof tests could use this value to determine whether a digit is expected to take 2 bytes or 4 (or ...) Added file: http://bugs.python.org/file11724/30bit.patch _______________________________________ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3944> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
