Commit bfdb44e5 authored by Stefan Behnel's avatar Stefan Behnel

test 'unsigned long' against maxint+1 to avoid dependency on real long size

parent 10b330fe
......@@ -3,15 +3,26 @@ __doc__ = """
0L
>>> test(1)
1L
>>> 2**36
68719476736L
>>> test(2**36)
0L
>>> test(2L**36)
0L
>>> import sys
>>> sys.maxint + 1 > sys.maxint
True
>>> type(sys.maxint * 2 + 1) is long
True
>>> test(sys.maxint + 1)
2147483648L
>>> test(sys.maxint * 2 + 1)
4294967295L
>>> test(8 ** unsigned_long_size() - 1) > sys.maxint
True
"""
def test(k):
cdef unsigned long m
m = k
return m
def unsigned_long_size():
return sizeof(unsigned long)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment