From 214134f00dcd895582d80f9f09a961f8e33eb02c Mon Sep 17 00:00:00 2001 From: David Warde-Farley Date: Tue, 20 Sep 2011 17:27:53 -0400 Subject: REF: simplify multi-loop breaking with a goto. --- numpy/lib/src/_compiled_base.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'numpy/lib/src') diff --git a/numpy/lib/src/_compiled_base.c b/numpy/lib/src/_compiled_base.c index 57a641b8c..58b9f5ecd 100644 --- a/numpy/lib/src/_compiled_base.c +++ b/numpy/lib/src/_compiled_base.c @@ -683,8 +683,10 @@ ravel_multi_index_loop(int ravel_ndim, npy_intp *ravel_dims, j = *(npy_intp *)coords[i]; switch (modes[i]) { case NPY_RAISE: - if (j < 0 || j >= m) + if (j < 0 || j >= m) { invalid = 1; + goto end_while; + } break; case NPY_WRAP: if (j < 0) { @@ -717,12 +719,10 @@ ravel_multi_index_loop(int ravel_ndim, npy_intp *ravel_dims, coords[i] += coords_strides[i]; } - if (invalid) { - break; - } *(npy_intp *)coords[ravel_ndim] = raveled; coords[ravel_ndim] += coords_strides[ravel_ndim]; } +end_while: NPY_END_ALLOW_THREADS; if (invalid) { PyErr_SetString(PyExc_ValueError, -- cgit v1.2.1