[Scipy-svn] r2982 - trunk/Lib/ndimage/src
scipy-svn at scipy.org
scipy-svn at scipy.org
Thu May 10 19:26:04 EDT 2007
Author: stefan
Date: 2007-05-10 18:25:48 -0500 (Thu, 10 May 2007)
New Revision: 2982
Modified:
trunk/Lib/ndimage/src/nd_image.c
trunk/Lib/ndimage/src/nd_image.h
Log:
ndimage: remove usage of NA_elements and NA_NBYTES.
Modified: trunk/Lib/ndimage/src/nd_image.c
===================================================================
--- trunk/Lib/ndimage/src/nd_image.c 2007-05-10 22:49:10 UTC (rev 2981)
+++ trunk/Lib/ndimage/src/nd_image.c 2007-05-10 23:25:48 UTC (rev 2982)
@@ -101,7 +101,7 @@
{
long *pa, ii;
PyArrayObject *array = NA_InputArray(object, PyArray_LONG, NPY_CARRAY);
- maybelong length = NA_elements(array);
+ maybelong length = PyArray_SIZE(array);
*sequence = (maybelong*)malloc(length * sizeof(maybelong));
if (!*sequence) {
Modified: trunk/Lib/ndimage/src/nd_image.h
===================================================================
--- trunk/Lib/ndimage/src/nd_image.h 2007-05-10 22:49:10 UTC (rev 2981)
+++ trunk/Lib/ndimage/src/nd_image.h 2007-05-10 23:25:48 UTC (rev 2982)
@@ -88,16 +88,6 @@
PyArray_CheckFromAny(a, descr, 0, 0, requires, NULL);
}
-static unsigned long
-NA_elements(PyArrayObject *a)
-{
- int i;
- unsigned long n = 1;
- for(i = 0; i<a->nd; i++)
- n *= a->dimensions[i];
- return n;
-}
-
/* satisfies ensures that 'a' meets a set of requirements and matches
the specified type.
*/
@@ -247,8 +237,6 @@
return self;
}
-#define NA_NBYTES(a) (a->descr->elsize * NA_elements(a))
-
static PyArrayObject *
NA_NewAll(int ndim, maybelong *shape, NumarrayType type,
void *buffer, maybelong byteoffset, maybelong bytestride,
@@ -265,9 +253,9 @@
result = NULL;
} else {
if (buffer) {
- memcpy(result->data, buffer, NA_NBYTES(result));
+ memcpy(result->data, buffer, PyArray_NBYTES(result));
} else {
- memset(result->data, 0, NA_NBYTES(result));
+ memset(result->data, 0, PyArray_NBYTES(result));
}
}
}
More information about the Scipy-svn
mailing list