projects
/
cython.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
10b330f
)
test 'unsigned long' against maxint+1 to avoid dependency on real long size
author
Stefan Behnel
<scoder@users.berlios.de>
Sun, 6 Jan 2008 07:51:55 +0000
(08:51 +0100)
committer
Stefan Behnel
<scoder@users.berlios.de>
Sun, 6 Jan 2008 07:51:55 +0000
(08:51 +0100)
tests/run/r_vree_1.pyx
patch
|
blob
|
history
diff --git
a/tests/run/r_vree_1.pyx
b/tests/run/r_vree_1.pyx
index a520d2e9b0da5359494452c6fe881406c47b7bf8..74d1ba13bb6b4aac0177ee5aaed6e066f0eaca12 100644
(file)
--- a/
tests/run/r_vree_1.pyx
+++ b/
tests/run/r_vree_1.pyx
@@
-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)