diff options
author | Kurt Smith <kwsmith1@wisc.edu> | 2009-08-11 00:32:21 -0500 |
---|---|---|
committer | Kurt Smith <kwsmith1@wisc.edu> | 2009-08-11 00:32:21 -0500 |
commit | 38f150575b356bb7bcfdd48e9e45f9f5dc85850e (patch) | |
tree | 1be739f666534796d63d97b4ce45fe8a6308fdef | |
parent | 59cc6a61fbb6034bc853150a5d4e486fb3c7bea1 (diff) | |
download | cython-38f150575b356bb7bcfdd48e9e45f9f5dc85850e.tar.gz |
indexing fix for copy contents C function in MemoryView.py
-rw-r--r-- | Cython/Compiler/MemoryView.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Cython/Compiler/MemoryView.py b/Cython/Compiler/MemoryView.py index 4f960dab4..d4fdee267 100644 --- a/Cython/Compiler/MemoryView.py +++ b/Cython/Compiler/MemoryView.py @@ -319,7 +319,10 @@ static int %(cfunc_name)s(const __Pyx_memviewslice *from_mvs, __Pyx_memviewslice for k in range(ndim): code += INDENT*(k+1) + "for(i%(k)d=0; i%(k)d<shape%(k)d; i%(k)d++) {\n" % {'k' : k} - code += INDENT*(k+2) + "idx%(k)d = i%(k)d * stride%(k)d;\n" % {'k' : k} + if k >= 1: + code += INDENT*(k+2) + "idx%(k)d = i%(k)d * stride%(k)d + idx%(km1)d;\n" % {'k' : k, 'km1' : k-1} + else: + code += INDENT*(k+2) + "idx%(k)d = i%(k)d * stride%(k)d;\n" % {'k' : k} # the inner part of the loop. dtype_decl = from_mvs.dtype.declaration_code("") |