[Numpy-svn] r3179 - trunk/numpy/core/src

numpy-svn at scipy.org numpy-svn at scipy.org
Mon Sep 18 15:38:23 CDT 2006


Author: oliphant
Date: 2006-09-18 15:36:43 -0500 (Mon, 18 Sep 2006)
New Revision: 3179

Modified:
   trunk/numpy/core/src/multiarraymodule.c
Log:
Rework fix to #282

Modified: trunk/numpy/core/src/multiarraymodule.c
===================================================================
--- trunk/numpy/core/src/multiarraymodule.c	2006-09-18 20:25:17 UTC (rev 3178)
+++ trunk/numpy/core/src/multiarraymodule.c	2006-09-18 20:36:43 UTC (rev 3179)
@@ -4529,7 +4529,7 @@
 	totalsize = 0;
 	for(i=0; i<n; i++) {
 		PyObject *tup, *descr, *index, *item, *name, *off;
-		int len, ret;
+		int len, ret, _align;
 		PyArray_Descr *newdescr;
 
 		/* Build item to insert (descr, offset, [title])*/
@@ -4552,6 +4552,10 @@
 			goto fail;
 		}
 		PyTuple_SET_ITEM(tup, 0, (PyObject *)newdescr);
+		if (align) {
+			_align = newdescr->alignment;
+			maxalign = MAX(maxalign,_align);
+		}
 		if (offsets) {
 			long offset;
 			off = PyObject_GetItem(offsets, index);
@@ -4566,16 +4570,12 @@
 			if (offset > totalsize) totalsize = offset;
 		}
 		else {
-			if (align) {
-				int _align = newdescr->alignment;
-				if (_align > 1) totalsize =		\
-					((totalsize + _align - 1)/_align)* \
-                                        _align;
+			if (align && _align > 1) {
+				totalsize = ((totalsize + _align - 1)   \
+					     /_align)*_align;
 			}
 			PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(totalsize));
 		}
-                if (align)
-                        maxalign = MAX(maxalign,newdescr->alignment);
 		if (len == 3) PyTuple_SET_ITEM(tup, 2, item);
 		name = PyObject_GetItem(names, index);
 		Py_DECREF(index);



More information about the Numpy-svn mailing list