projects
/
cython.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
4731435
)
fix signed/unsigned comparison in buffer access code
author
Lisandro Dalcin
<dalcinl@gmail.com>
Thu, 11 Mar 2010 16:42:02 +0000
(13:42 -0300)
committer
Lisandro Dalcin
<dalcinl@gmail.com>
Thu, 11 Mar 2010 16:42:02 +0000
(13:42 -0300)
Cython/Compiler/Buffer.py
patch
|
blob
|
history
diff --git
a/Cython/Compiler/Buffer.py
b/Cython/Compiler/Buffer.py
index bf6eef8b9083c5459492918881bb0a74bd560345..955ee2058df85cb9e5631687b78de5c3cf1c5a88 100644
(file)
--- a/
Cython/Compiler/Buffer.py
+++ b/
Cython/Compiler/Buffer.py
@@
-368,8
+368,12
@@
def put_buffer_lookup_code(entry, index_signeds, index_cnames, directives, pos,
code.putln("%s = %d;" % (tmp_cname, dim))
code.put("} else ")
# check bounds in positive direction
+ if signed != 0:
+ cast = ""
+ else:
+ cast = "(size_t)"
code.putln("if (%s) %s = %d;" % (
- code.unlikely("%s >= %s
" % (cname
, shape.cname)),
+ code.unlikely("%s >= %s
%s" % (cname, cast
, shape.cname)),
tmp_cname, dim))
code.globalstate.use_utility_code(raise_indexerror_code)
code.putln("if (%s) {" % code.unlikely("%s != -1" % tmp_cname))