[pypy-commit] pypy numpy-multidim-shards: promote shape length
fijal
noreply at buildbot.pypy.org
Sat Nov 19 16:45:17 CET 2011
Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: numpy-multidim-shards
Changeset: r49548:fede8d91e0a4
Date: 2011-11-19 17:44 +0200
http://bitbucket.org/pypy/pypy/changeset/fede8d91e0a4/
Log: promote shape length
diff --git a/pypy/module/micronumpy/interp_numarray.py b/pypy/module/micronumpy/interp_numarray.py
--- a/pypy/module/micronumpy/interp_numarray.py
+++ b/pypy/module/micronumpy/interp_numarray.py
@@ -164,10 +164,12 @@
self.offset = arr.start
self.arr = arr
self._done = False
+ self.shape_len = len(arr.shape)
@jit.unroll_safe
def next(self):
- for i in range(len(self.arr.shape) -1, -1, -1):
+ shape_len = jit.promote(self.shape_len)
+ for i in range(shape_len - 1, -1, -1):
if self.indices[i] < self.arr.shape[i] - 1:
self.indices[i] += 1
self.offset += self.arr.shards[i]
More information about the pypy-commit
mailing list