From 16013d99a464dbad3dd016ed0e1473bb7c6c9e09 Mon Sep 17 00:00:00 2001 From: Travis Oliphant Date: Sat, 8 Jul 2006 09:26:41 +0000 Subject: Fix 0-stride contiguous bug. --- numpy/core/src/arrayobject.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'numpy/core/src/arrayobject.c') diff --git a/numpy/core/src/arrayobject.c b/numpy/core/src/arrayobject.c index 85357bda2..30efc95cf 100644 --- a/numpy/core/src/arrayobject.c +++ b/numpy/core/src/arrayobject.c @@ -4566,8 +4566,6 @@ _IsContiguous(PyArrayObject *ap) register intp sd; register intp dim; register int i; - register intp stride; - if (ap->nd == 0) return 1; sd = ap->descr->elsize; @@ -4577,9 +4575,7 @@ _IsContiguous(PyArrayObject *ap) dim = ap->dimensions[i]; /* contiguous by definition */ if (dim == 0) return 1; - stride = ap->strides[i]; - if (stride == 0 && dim == 1) continue; - if (stride != sd) return 0; + if (ap->strides[i] != sd) return 0; sd *= dim; } return 1; @@ -4592,7 +4588,6 @@ _IsFortranContiguous(PyArrayObject *ap) register intp sd; register intp dim; register int i; - register intp stride; if (ap->nd == 0) return 1; sd = ap->descr->elsize; @@ -4602,9 +4597,7 @@ _IsFortranContiguous(PyArrayObject *ap) dim = ap->dimensions[i]; /* fortran contiguous by definition */ if (dim == 0) return 1; - stride = ap->strides[i]; - if (stride == 0 && dim == 1) continue; - if (stride != sd) return 0; + if (ap->strides[i] != sd) return 0; sd *= dim; } return 1; -- cgit v1.2.1