Skip to content

Commit

Permalink
Fixed backwards compatibility with Numeric on 64-bit machines.
Browse files Browse the repository at this point in the history
  • Loading branch information
teoliphant committed Oct 8, 2005
1 parent b81e0a0 commit 47c9ceb
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
5 changes: 5 additions & 0 deletions scipy/base/code_generators/generate_array_api.py
Expand Up @@ -393,6 +393,11 @@
""",
'MultiplyList','intp *lp, int n','intp'),

(r"""Multiply a List of ints
""",
'MultiplyIntList','int *lp, int n','int'),


(r"""Compare Lists
""",
'CompareLists','intp *, intp *, int n','int'),
Expand Down
4 changes: 2 additions & 2 deletions scipy/base/include/scipy/arrayobject.h
Expand Up @@ -1219,8 +1219,8 @@ typedef struct {
#define PyArray_SBYTE PyArray_BYTE
#define PyArray_CHAR PyArray_BYTE
#define PyArray_CopyArray PyArray_CopyInto
#define _PyArray_multiply_list PyArray_MultiplyList
#define PyArray_ISSPACESAVER(m) TRUE
#define _PyArray_multiply_list PyArray_MultiplyIntList
#define PyArray_ISSPACESAVER(m) FALSE
#define PyScalarArray_Check PyArray_CheckScalar


Expand Down
13 changes: 10 additions & 3 deletions scipy/base/src/multiarraymodule.c
Expand Up @@ -47,12 +47,19 @@ static PyObject *typeDict=NULL; /* Must be explicitly loaded */
/* An Error object -- rarely used? */
static PyObject *MultiArrayError;

static int
PyArray_MultiplyIntList(register int *l1, register int n)
{
register int s=1;
while (n--) s *= (*l1++);
return s;
}

static intp
PyArray_MultiplyList(intp *l1, int n)
PyArray_MultiplyList(register intp *l1, register int n)
{
register intp s=1;
register int i=0;
while (i++ < n) s *= (*l1++);
while (n--) s *= (*l1++);
return s;
}

Expand Down

0 comments on commit 47c9ceb

Please sign in to comment.