Message74430
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 ...) |
|
Date |
User |
Action |
Args |
2008-10-07 09:16:03 | mark.dickinson | set | recipients:
+ mark.dickinson, pernici, christian.heimes, fredrikj |
2008-10-07 09:16:03 | mark.dickinson | set | messageid: <1223370963.45.0.584915490482.issue3944@psf.upfronthosting.co.za> |
2008-10-07 09:16:02 | mark.dickinson | link | issue3944 messages |
2008-10-07 09:16:01 | mark.dickinson | create | |
|