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__ = """ ...@@ -3,15 +3,26 @@ __doc__ = """
0L 0L
>>> test(1) >>> test(1)
1L 1L
>>> 2**36
68719476736L >>> import sys
>>> test(2**36) >>> sys.maxint + 1 > sys.maxint
0L True
>>> test(2L**36) >>> type(sys.maxint * 2 + 1) is long
0L True
>>> test(sys.maxint + 1)
2147483648L
>>> test(sys.maxint * 2 + 1)
4294967295L
>>> test(8 ** unsigned_long_size() - 1) > sys.maxint
True
""" """
def test(k): def test(k):
cdef unsigned long m cdef unsigned long m
m = k m = k
return m 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