Author: Maciej Fijalkowski <fij...@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]
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to