diff options
author | Travis Oliphant <oliphant@enthought.com> | 2006-03-23 04:18:27 +0000 |
---|---|---|
committer | Travis Oliphant <oliphant@enthought.com> | 2006-03-23 04:18:27 +0000 |
commit | 6e5c13bbebbadd646f816fae36d2094612462185 (patch) | |
tree | 3a4f5a4297eb8c93bc53a0caacc8b63836381cbf /numpy/core/src/arrayobject.c | |
parent | 0e72b1b67f1291aef293a77138ad94d459d8448b (diff) | |
download | numpy-6e5c13bbebbadd646f816fae36d2094612462185.tar.gz |
compress code
Diffstat (limited to 'numpy/core/src/arrayobject.c')
-rw-r--r-- | numpy/core/src/arrayobject.c | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/numpy/core/src/arrayobject.c b/numpy/core/src/arrayobject.c index 60449a2c1..bbfb94e27 100644 --- a/numpy/core/src/arrayobject.c +++ b/numpy/core/src/arrayobject.c @@ -2635,15 +2635,12 @@ array_remainder(PyArrayObject *m1, PyObject *m2) return PyArray_GenericBinaryFunction(m1, m2, n_ops.remainder); } - -static PyObject *array_float(PyArrayObject *v); -static PyObject *gentype_float(PyObject *v); - static int array_power_is_scalar(PyObject *o2, double* exp) { PyObject *temp; const int optimize_fpexps = 1; + if (PyInt_Check(o2)) { *exp = (double)PyInt_AsLong(o2); return 1; @@ -2652,20 +2649,12 @@ array_power_is_scalar(PyObject *o2, double* exp) *exp = PyFloat_AsDouble(o2); return 1; } - if (PyArray_IsZeroDim(o2)) { - if (PyArray_ISINTEGER(o2) || - (optimize_fpexps && PyArray_ISFLOAT(o2))) { - temp = array_float((PyArrayObject *)o2); - if (temp != NULL) { - *exp = PyFloat_AsDouble(o2); - Py_DECREF(temp); - return 1; - } - } - } - if (PyArray_IsScalar(o2, Integer) || + if ((PyArray_IsZeroDim(o2) && + ((PyArray_ISINTEGER(o2) || + (optimize_fpexps && PyArray_ISFLOAT(o2))))) || + PyArray_IsScalar(o2, Integer) || (optimize_fpexps && PyArray_IsScalar(o2, Floating))) { - temp = gentype_float(o2); + temp = o2->ob_type->tp_as_number->nb_float(o2); if (temp != NULL) { *exp = PyFloat_AsDouble(o2); Py_DECREF(temp); |