summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorTravis Oliphant <oliphant@enthought.com>2006-02-09 05:54:19 +0000
committerTravis Oliphant <oliphant@enthought.com>2006-02-09 05:54:19 +0000
commite4df04ac07a6442d711a34cfa64d64c033f4f1a8 (patch)
tree25ac15308266440a63f6883447b55ce6b1fea8f9 /numpy
parent94291389d72f38b2a1641fd7b82d14e2fd691f1f (diff)
downloadnumpy-e4df04ac07a6442d711a34cfa64d64c033f4f1a8.tar.gz
Speed up fill a little.
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/src/arraytypes.inc.src12
1 files changed, 8 insertions, 4 deletions
diff --git a/numpy/core/src/arraytypes.inc.src b/numpy/core/src/arraytypes.inc.src
index b2b005fc4..16f7057c5 100644
--- a/numpy/core/src/arraytypes.inc.src
+++ b/numpy/core/src/arraytypes.inc.src
@@ -1648,15 +1648,17 @@ OBJECT_fill(PyObject **buffer, intp length, void *ignored)
static void
@NAME@_fill(@typ@ *buffer, intp length, void *ignored)
{
- intp i;
+ @typ@ *buffermax;
@typ@ start = buffer[0];
@typ@ delta = buffer[1];
delta -= start;
start += (delta + delta);
+ buffermax = buffer + length;
buffer += 2;
- for (i=2; i<length; i++, buffer++) {
+ while(buffer < buffermax) {
*buffer = start;
start += delta;
+ buffer++;
}
}
/**end repeat**/
@@ -1668,9 +1670,9 @@ static void
static void
@NAME@_fill(@typ@ *buffer, intp length, void *ignored)
{
- intp i;
@typ@ start;
@typ@ delta;
+ @typ@ *buffermax;
start.real = buffer->real;
start.imag = buffer->imag;
@@ -1680,12 +1682,14 @@ static void
delta.imag -= start.imag;
start.real += (delta.real + delta.real);
start.imag += (delta.imag + delta.imag);
+ buffermax = buffer + length;
buffer += 2;
- for (i=2; i<length; i++, buffer++) {
+ while (buffer < buffermax) {
buffer->real = start.real;
buffer->imag = start.imag;
start.real += delta.real;
start.imag += delta.imag;
+ buffer++;
}
}
/**end repeat**/