summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--numpy/core/include/numpy/arrayscalars.h118
-rw-r--r--numpy/core/include/numpy/fenv/fenv.c10
-rw-r--r--numpy/core/include/numpy/fenv/fenv.h196
-rw-r--r--numpy/core/include/numpy/ndarrayobject.h54
-rw-r--r--numpy/core/include/numpy/noprefix.h4
-rw-r--r--numpy/core/include/numpy/npy_common.h6
-rw-r--r--numpy/core/include/numpy/npy_math.h6
-rw-r--r--numpy/core/include/numpy/numpyconfig.h.in2
-rw-r--r--numpy/core/include/numpy/ufuncobject.h240
-rw-r--r--numpy/core/include/numpy/utils.h14
10 files changed, 325 insertions, 325 deletions
diff --git a/numpy/core/include/numpy/arrayscalars.h b/numpy/core/include/numpy/arrayscalars.h
index 4d840e719..1f7f3c7e3 100644
--- a/numpy/core/include/numpy/arrayscalars.h
+++ b/numpy/core/include/numpy/arrayscalars.h
@@ -3,140 +3,140 @@
#ifndef _MULTIARRAYMODULE
typedef struct {
- PyObject_HEAD
- npy_bool obval;
+ PyObject_HEAD
+ npy_bool obval;
} PyBoolScalarObject;
#endif
typedef struct {
- PyObject_HEAD
- signed char obval;
+ PyObject_HEAD
+ signed char obval;
} PyByteScalarObject;
typedef struct {
- PyObject_HEAD
- short obval;
+ PyObject_HEAD
+ short obval;
} PyShortScalarObject;
typedef struct {
- PyObject_HEAD
- int obval;
+ PyObject_HEAD
+ int obval;
} PyIntScalarObject;
typedef struct {
- PyObject_HEAD
- long obval;
+ PyObject_HEAD
+ long obval;
} PyLongScalarObject;
typedef struct {
- PyObject_HEAD
- npy_longlong obval;
+ PyObject_HEAD
+ npy_longlong obval;
} PyLongLongScalarObject;
typedef struct {
- PyObject_HEAD
- unsigned char obval;
+ PyObject_HEAD
+ unsigned char obval;
} PyUByteScalarObject;
typedef struct {
- PyObject_HEAD
- unsigned short obval;
+ PyObject_HEAD
+ unsigned short obval;
} PyUShortScalarObject;
typedef struct {
- PyObject_HEAD
- unsigned int obval;
+ PyObject_HEAD
+ unsigned int obval;
} PyUIntScalarObject;
typedef struct {
- PyObject_HEAD
- unsigned long obval;
+ PyObject_HEAD
+ unsigned long obval;
} PyULongScalarObject;
typedef struct {
- PyObject_HEAD
- npy_ulonglong obval;
+ PyObject_HEAD
+ npy_ulonglong obval;
} PyULongLongScalarObject;
typedef struct {
- PyObject_HEAD
- float obval;
+ PyObject_HEAD
+ float obval;
} PyFloatScalarObject;
typedef struct {
- PyObject_HEAD
- double obval;
+ PyObject_HEAD
+ double obval;
} PyDoubleScalarObject;
typedef struct {
- PyObject_HEAD
- npy_longdouble obval;
+ PyObject_HEAD
+ npy_longdouble obval;
} PyLongDoubleScalarObject;
typedef struct {
- PyObject_HEAD
- npy_cfloat obval;
+ PyObject_HEAD
+ npy_cfloat obval;
} PyCFloatScalarObject;
typedef struct {
- PyObject_HEAD
- npy_cdouble obval;
+ PyObject_HEAD
+ npy_cdouble obval;
} PyCDoubleScalarObject;
typedef struct {
- PyObject_HEAD
- npy_clongdouble obval;
+ PyObject_HEAD
+ npy_clongdouble obval;
} PyCLongDoubleScalarObject;
typedef struct {
- PyObject_HEAD
- PyObject * obval;
+ PyObject_HEAD
+ PyObject * obval;
} PyObjectScalarObject;
typedef struct {
PyObject_HEAD
npy_datetime obval;
- PyArray_DatetimeMetaData obmeta;
+ PyArray_DatetimeMetaData obmeta;
} PyDatetimeScalarObject;
typedef struct {
PyObject_HEAD
npy_timedelta obval;
- PyArray_DatetimeMetaData obmeta;
+ PyArray_DatetimeMetaData obmeta;
} PyTimedeltaScalarObject;
typedef struct {
- PyObject_HEAD
- char obval;
+ PyObject_HEAD
+ char obval;
} PyScalarObject;
#define PyStringScalarObject PyStringObject
#define PyUnicodeScalarObject PyUnicodeObject
typedef struct {
- PyObject_VAR_HEAD
- char *obval;
- PyArray_Descr *descr;
- int flags;
- PyObject *base;
+ PyObject_VAR_HEAD
+ char *obval;
+ PyArray_Descr *descr;
+ int flags;
+ PyObject *base;
} PyVoidScalarObject;
/* Macros
@@ -148,22 +148,22 @@ typedef struct {
#define PyArrayScalar_False ((PyObject *)(&(_PyArrayScalar_BoolValues[0])))
#define PyArrayScalar_True ((PyObject *)(&(_PyArrayScalar_BoolValues[1])))
#define PyArrayScalar_FromLong(i) \
- ((PyObject *)(&(_PyArrayScalar_BoolValues[((i)!=0)])))
-#define PyArrayScalar_RETURN_BOOL_FROM_LONG(i) \
- return Py_INCREF(PyArrayScalar_FromLong(i)), \
- PyArrayScalar_FromLong(i)
-#define PyArrayScalar_RETURN_FALSE \
- return Py_INCREF(PyArrayScalar_False), \
- PyArrayScalar_False
-#define PyArrayScalar_RETURN_TRUE \
- return Py_INCREF(PyArrayScalar_True), \
- PyArrayScalar_True
+ ((PyObject *)(&(_PyArrayScalar_BoolValues[((i)!=0)])))
+#define PyArrayScalar_RETURN_BOOL_FROM_LONG(i) \
+ return Py_INCREF(PyArrayScalar_FromLong(i)), \
+ PyArrayScalar_FromLong(i)
+#define PyArrayScalar_RETURN_FALSE \
+ return Py_INCREF(PyArrayScalar_False), \
+ PyArrayScalar_False
+#define PyArrayScalar_RETURN_TRUE \
+ return Py_INCREF(PyArrayScalar_True), \
+ PyArrayScalar_True
#define PyArrayScalar_New(cls) \
- Py##cls##ArrType_Type.tp_alloc(&Py##cls##ArrType_Type, 0)
-#define PyArrayScalar_VAL(obj, cls) \
- ((Py##cls##ScalarObject *)obj)->obval
+ Py##cls##ArrType_Type.tp_alloc(&Py##cls##ArrType_Type, 0)
+#define PyArrayScalar_VAL(obj, cls) \
+ ((Py##cls##ScalarObject *)obj)->obval
#define PyArrayScalar_ASSIGN(obj, cls, val) \
- PyArrayScalar_VAL(obj, cls) = val
+ PyArrayScalar_VAL(obj, cls) = val
#endif
diff --git a/numpy/core/include/numpy/fenv/fenv.c b/numpy/core/include/numpy/fenv/fenv.c
index 169642ce1..9a8d1be10 100644
--- a/numpy/core/include/numpy/fenv/fenv.c
+++ b/numpy/core/include/numpy/fenv/fenv.c
@@ -30,9 +30,9 @@
#include "fenv.h"
const fenv_t npy__fe_dfl_env = {
- 0xffff0000,
- 0xffff0000,
- 0xffffffff,
- { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff }
+ 0xffff0000,
+ 0xffff0000,
+ 0xffffffff,
+ { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff }
};
diff --git a/numpy/core/include/numpy/fenv/fenv.h b/numpy/core/include/numpy/fenv/fenv.h
index 70b3d83f8..79a215fc3 100644
--- a/numpy/core/include/numpy/fenv/fenv.h
+++ b/numpy/core/include/numpy/fenv/fenv.h
@@ -26,173 +26,173 @@
* $FreeBSD$
*/
-#ifndef _FENV_H_
-#define _FENV_H_
+#ifndef _FENV_H_
+#define _FENV_H_
#include <sys/cdefs.h>
#include <sys/types.h>
typedef struct {
- __uint32_t __control;
- __uint32_t __status;
- __uint32_t __tag;
- char __other[16];
+ __uint32_t __control;
+ __uint32_t __status;
+ __uint32_t __tag;
+ char __other[16];
} fenv_t;
-typedef __uint16_t fexcept_t;
+typedef __uint16_t fexcept_t;
/* Exception flags */
-#define FE_INVALID 0x01
-#define FE_DENORMAL 0x02
-#define FE_DIVBYZERO 0x04
-#define FE_OVERFLOW 0x08
-#define FE_UNDERFLOW 0x10
-#define FE_INEXACT 0x20
-#define FE_ALL_EXCEPT (FE_DIVBYZERO | FE_DENORMAL | FE_INEXACT | \
- FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW)
+#define FE_INVALID 0x01
+#define FE_DENORMAL 0x02
+#define FE_DIVBYZERO 0x04
+#define FE_OVERFLOW 0x08
+#define FE_UNDERFLOW 0x10
+#define FE_INEXACT 0x20
+#define FE_ALL_EXCEPT (FE_DIVBYZERO | FE_DENORMAL | FE_INEXACT | \
+ FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW)
/* Rounding modes */
-#define FE_TONEAREST 0x0000
-#define FE_DOWNWARD 0x0400
-#define FE_UPWARD 0x0800
-#define FE_TOWARDZERO 0x0c00
-#define _ROUND_MASK (FE_TONEAREST | FE_DOWNWARD | \
- FE_UPWARD | FE_TOWARDZERO)
+#define FE_TONEAREST 0x0000
+#define FE_DOWNWARD 0x0400
+#define FE_UPWARD 0x0800
+#define FE_TOWARDZERO 0x0c00
+#define _ROUND_MASK (FE_TONEAREST | FE_DOWNWARD | \
+ FE_UPWARD | FE_TOWARDZERO)
__BEGIN_DECLS
/* Default floating-point environment */
-extern const fenv_t npy__fe_dfl_env;
-#define FE_DFL_ENV (&npy__fe_dfl_env)
+extern const fenv_t npy__fe_dfl_env;
+#define FE_DFL_ENV (&npy__fe_dfl_env)
-#define __fldcw(__cw) __asm __volatile("fldcw %0" : : "m" (__cw))
-#define __fldenv(__env) __asm __volatile("fldenv %0" : : "m" (__env))
-#define __fnclex() __asm __volatile("fnclex")
-#define __fnstenv(__env) __asm __volatile("fnstenv %0" : "=m" (*(__env)))
-#define __fnstcw(__cw) __asm __volatile("fnstcw %0" : "=m" (*(__cw)))
-#define __fnstsw(__sw) __asm __volatile("fnstsw %0" : "=am" (*(__sw)))
-#define __fwait() __asm __volatile("fwait")
+#define __fldcw(__cw) __asm __volatile("fldcw %0" : : "m" (__cw))
+#define __fldenv(__env) __asm __volatile("fldenv %0" : : "m" (__env))
+#define __fnclex() __asm __volatile("fnclex")
+#define __fnstenv(__env) __asm __volatile("fnstenv %0" : "=m" (*(__env)))
+#define __fnstcw(__cw) __asm __volatile("fnstcw %0" : "=m" (*(__cw)))
+#define __fnstsw(__sw) __asm __volatile("fnstsw %0" : "=am" (*(__sw)))
+#define __fwait() __asm __volatile("fwait")
static __inline int
feclearexcept(int __excepts)
{
- fenv_t __env;
-
- if (__excepts == FE_ALL_EXCEPT) {
- __fnclex();
- } else {
- __fnstenv(&__env);
- __env.__status &= ~__excepts;
- __fldenv(__env);
- }
- return (0);
+ fenv_t __env;
+
+ if (__excepts == FE_ALL_EXCEPT) {
+ __fnclex();
+ } else {
+ __fnstenv(&__env);
+ __env.__status &= ~__excepts;
+ __fldenv(__env);
+ }
+ return (0);
}
static __inline int
fegetexceptflag(fexcept_t *__flagp, int __excepts)
{
- __uint16_t __status;
+ __uint16_t __status;
- __fnstsw(&__status);
- *__flagp = __status & __excepts;
- return (0);
+ __fnstsw(&__status);
+ *__flagp = __status & __excepts;
+ return (0);
}
static __inline int
fesetexceptflag(const fexcept_t *__flagp, int __excepts)
{
- fenv_t __env;
+ fenv_t __env;
- __fnstenv(&__env);
- __env.__status &= ~__excepts;
- __env.__status |= *__flagp & __excepts;
- __fldenv(__env);
- return (0);
+ __fnstenv(&__env);
+ __env.__status &= ~__excepts;
+ __env.__status |= *__flagp & __excepts;
+ __fldenv(__env);
+ return (0);
}
static __inline int
feraiseexcept(int __excepts)
{
- fexcept_t __ex = __excepts;
+ fexcept_t __ex = __excepts;
- fesetexceptflag(&__ex, __excepts);
- __fwait();
- return (0);
+ fesetexceptflag(&__ex, __excepts);
+ __fwait();
+ return (0);
}
static __inline int
fetestexcept(int __excepts)
{
- __uint16_t __status;
+ __uint16_t __status;
- __fnstsw(&__status);
- return (__status & __excepts);
+ __fnstsw(&__status);
+ return (__status & __excepts);
}
static __inline int
fegetround(void)
{
- int __control;
+ int __control;
- __fnstcw(&__control);
- return (__control & _ROUND_MASK);
+ __fnstcw(&__control);
+ return (__control & _ROUND_MASK);
}
static __inline int
fesetround(int __round)
{
- int __control;
-
- if (__round & ~_ROUND_MASK)
- return (-1);
- __fnstcw(&__control);
- __control &= ~_ROUND_MASK;
- __control |= __round;
- __fldcw(__control);
- return (0);
+ int __control;
+
+ if (__round & ~_ROUND_MASK)
+ return (-1);
+ __fnstcw(&__control);
+ __control &= ~_ROUND_MASK;
+ __control |= __round;
+ __fldcw(__control);
+ return (0);
}
static __inline int
fegetenv(fenv_t *__envp)
{
- int __control;
-
- /*
- * fnstenv masks all exceptions, so we need to save and
- * restore the control word to avoid this side effect.
- */
- __fnstcw(&__control);
- __fnstenv(__envp);
- __fldcw(__control);
- return (0);
+ int __control;
+
+ /*
+ * fnstenv masks all exceptions, so we need to save and
+ * restore the control word to avoid this side effect.
+ */
+ __fnstcw(&__control);
+ __fnstenv(__envp);
+ __fldcw(__control);
+ return (0);
}
static __inline int
feholdexcept(fenv_t *__envp)
{
- __fnstenv(__envp);
- __fnclex();
- return (0);
+ __fnstenv(__envp);
+ __fnclex();
+ return (0);
}
static __inline int
fesetenv(const fenv_t *__envp)
{
- __fldenv(*__envp);
- return (0);
+ __fldenv(*__envp);
+ return (0);
}
static __inline int
feupdateenv(const fenv_t *__envp)
{
- __uint16_t __status;
+ __uint16_t __status;
- __fnstsw(&__status);
- __fldenv(*__envp);
- feraiseexcept(__status & FE_ALL_EXCEPT);
- return (0);
+ __fnstsw(&__status);
+ __fldenv(*__envp);
+ feraiseexcept(__status & FE_ALL_EXCEPT);
+ return (0);
}
#if __BSD_VISIBLE
@@ -200,25 +200,25 @@ feupdateenv(const fenv_t *__envp)
static __inline int
fesetmask(int __mask)
{
- int __control;
+ int __control;
- __fnstcw(&__control);
- __mask = (__control | FE_ALL_EXCEPT) & ~__mask;
- __fldcw(__mask);
- return (~__control & FE_ALL_EXCEPT);
+ __fnstcw(&__control);
+ __mask = (__control | FE_ALL_EXCEPT) & ~__mask;
+ __fldcw(__mask);
+ return (~__control & FE_ALL_EXCEPT);
}
static __inline int
fegetmask(void)
{
- int __control;
+ int __control;
- __fnstcw(&__control);
- return (~__control & FE_ALL_EXCEPT);
+ __fnstcw(&__control);
+ return (~__control & FE_ALL_EXCEPT);
}
#endif /* __BSD_VISIBLE */
__END_DECLS
-#endif /* !_FENV_H_ */
+#endif /* !_FENV_H_ */
diff --git a/numpy/core/include/numpy/ndarrayobject.h b/numpy/core/include/numpy/ndarrayobject.h
index 6f73f4408..1b6abd800 100644
--- a/numpy/core/include/numpy/ndarrayobject.h
+++ b/numpy/core/include/numpy/ndarrayobject.h
@@ -188,20 +188,20 @@ typedef enum {
} NPY_CLIPMODE;
typedef enum {
- NPY_FR_Y,
- NPY_FR_M,
- NPY_FR_W,
- NPY_FR_B,
- NPY_FR_D,
- NPY_FR_h,
- NPY_FR_m,
- NPY_FR_s,
- NPY_FR_ms,
- NPY_FR_us,
- NPY_FR_ns,
- NPY_FR_ps,
- NPY_FR_fs,
- NPY_FR_as
+ NPY_FR_Y,
+ NPY_FR_M,
+ NPY_FR_W,
+ NPY_FR_B,
+ NPY_FR_D,
+ NPY_FR_h,
+ NPY_FR_m,
+ NPY_FR_s,
+ NPY_FR_ms,
+ NPY_FR_us,
+ NPY_FR_ns,
+ NPY_FR_ps,
+ NPY_FR_fs,
+ NPY_FR_as
} NPY_DATETIMEUNIT;
#define NPY_DATETIME_NUMUNITS (NPY_FR_as + 1)
@@ -280,9 +280,9 @@ typedef Py_uintptr_t npy_uintp;
/* We can only use C99 formats for npy_int_p if it is the same as intp_t, hence
* the condition on HAVE_UNITPTR_T */
#if (NPY_USE_C99_FORMATS) == 1 \
- && (defined HAVE_UINTPTR_T) \
- && (defined HAVE_INTTYPES_H)
- #include <inttypes.h>
+ && (defined HAVE_UINTPTR_T) \
+ && (defined HAVE_INTTYPES_H)
+ #include <inttypes.h>
#undef NPY_INTP_FMT
#define NPY_INTP_FMT PRIdPTR
#endif
@@ -576,19 +576,19 @@ typedef struct {
typedef struct {
NPY_DATETIMEUNIT base;
- int num;
- int den; /* Converted to 1 on input for now -- an input-only mechanism */
- int events;
+ int num;
+ int den; /* Converted to 1 on input for now -- an input-only mechanism */
+ int events;
} PyArray_DatetimeMetaData;
typedef struct {
- npy_longlong year;
- int month, day, hour, min, sec, us, ps, as;
+ npy_longlong year;
+ int month, day, hour, min, sec, us, ps, as;
} npy_datetimestruct;
typedef struct {
- npy_longlong day;
- int sec, us, ps, as;
+ npy_longlong day;
+ int sec, us, ps, as;
} npy_timedeltastruct;
@@ -774,7 +774,7 @@ struct PyArrayIterObject_tag {
_PyAIT(it)->index = 0; \
_PyAIT(it)->dataptr = _PyAIT(it)->ao->data; \
memset(_PyAIT(it)->coordinates, 0, \
- (_PyAIT(it)->nd_m1+1)*sizeof(npy_intp)); \
+ (_PyAIT(it)->nd_m1+1)*sizeof(npy_intp)); \
}
#define _PyArray_ITER_NEXT1(it) { \
@@ -822,7 +822,7 @@ struct PyArrayIterObject_tag {
_PyArray_ITER_NEXT1(_PyAIT(it)); \
} \
else if (_PyAIT(it)->contiguous) \
- _PyAIT(it)->dataptr += _PyAIT(it)->ao->descr->elsize; \
+ _PyAIT(it)->dataptr += _PyAIT(it)->ao->descr->elsize; \
else if (_PyAIT(it)->nd_m1 == 1) { \
_PyArray_ITER_NEXT2(_PyAIT(it)); \
} \
@@ -1444,7 +1444,7 @@ typedef struct {
*/
#define NPY_TITLE_KEY(key, value) ((PyTuple_GET_SIZE((value))==3) && \
- (PyTuple_GET_ITEM((value), 2) == (key)))
+ (PyTuple_GET_ITEM((value), 2) == (key)))
/* Define python version independent deprecation macro */
diff --git a/numpy/core/include/numpy/noprefix.h b/numpy/core/include/numpy/noprefix.h
index ca66d2970..d4ccfc4a3 100644
--- a/numpy/core/include/numpy/noprefix.h
+++ b/numpy/core/include/numpy/noprefix.h
@@ -129,8 +129,8 @@ compatibility measure*/
#define BEGIN_THREADS NPY_BEGIN_THREADS
#define END_THREADS NPY_END_THREADS
#define ALLOW_C_API_DEF NPY_ALLOW_C_API_DEF
-#define ALLOW_C_API NPY_ALLOW_C_API
-#define DISABLE_C_API NPY_DISABLE_C_API
+#define ALLOW_C_API NPY_ALLOW_C_API
+#define DISABLE_C_API NPY_DISABLE_C_API
#define PY_FAIL NPY_FAIL
#define PY_SUCCEED NPY_SUCCEED
diff --git a/numpy/core/include/numpy/npy_common.h b/numpy/core/include/numpy/npy_common.h
index f15be0a41..4f282b6f5 100644
--- a/numpy/core/include/numpy/npy_common.h
+++ b/numpy/core/include/numpy/npy_common.h
@@ -14,9 +14,9 @@
/* enums for detected endianness */
enum {
- NPY_CPU_UNKNOWN_ENDIAN,
- NPY_CPU_LITTLE,
- NPY_CPU_BIG
+ NPY_CPU_UNKNOWN_ENDIAN,
+ NPY_CPU_LITTLE,
+ NPY_CPU_BIG
};
/* Some platforms don't define bool, long long, or long double.
diff --git a/numpy/core/include/numpy/npy_math.h b/numpy/core/include/numpy/npy_math.h
index c219504e4..ce1ec631e 100644
--- a/numpy/core/include/numpy/npy_math.h
+++ b/numpy/core/include/numpy/npy_math.h
@@ -161,9 +161,9 @@ double npy_copysign(double x, double y);
#endif
#ifndef NPY_HAVE_DECL_SIGNBIT
- int _npy_signbit_f(float x);
- int _npy_signbit_d(double x);
- int _npy_signbit_ld(npy_longdouble x);
+ int _npy_signbit_f(float x);
+ int _npy_signbit_d(double x);
+ int _npy_signbit_ld(npy_longdouble x);
#define npy_signbit(x) \
(sizeof (x) == sizeof (long double) ? _npy_signbit_ld (x) \
: sizeof (x) == sizeof (double) ? _npy_signbit_d (x) \
diff --git a/numpy/core/include/numpy/numpyconfig.h.in b/numpy/core/include/numpy/numpyconfig.h.in
index 0ba44b7b2..b30f39723 100644
--- a/numpy/core/include/numpy/numpyconfig.h.in
+++ b/numpy/core/include/numpy/numpyconfig.h.in
@@ -31,5 +31,5 @@
/* Ugly, but we can't test this in a proper manner without requiring a C++
* compiler at the configuration stage of numpy ? */
#ifndef __STDC_FORMAT_MACROS
- #define __STDC_FORMAT_MACROS 1
+ #define __STDC_FORMAT_MACROS 1
#endif
diff --git a/numpy/core/include/numpy/ufuncobject.h b/numpy/core/include/numpy/ufuncobject.h
index 6bbf3de13..b795b5418 100644
--- a/numpy/core/include/numpy/ufuncobject.h
+++ b/numpy/core/include/numpy/ufuncobject.h
@@ -7,18 +7,18 @@ extern "C" {
typedef void (*PyUFuncGenericFunction) (char **, npy_intp *, npy_intp *, void *);
typedef struct {
- PyObject_HEAD
- int nin, nout, nargs;
- int identity;
- PyUFuncGenericFunction *functions;
- void **data;
- int ntypes;
- int check_return;
- char *name, *types;
- char *doc;
+ PyObject_HEAD
+ int nin, nout, nargs;
+ int identity;
+ PyUFuncGenericFunction *functions;
+ void **data;
+ int ntypes;
+ int check_return;
+ char *name, *types;
+ char *doc;
void *ptr;
PyObject *obj;
- PyObject *userloops;
+ PyObject *userloops;
/* generalized ufunc */
int core_enabled; /* 0 for scalar ufunc; 1 for generalized ufunc */
@@ -44,7 +44,7 @@ typedef struct {
#define UFUNC_ERR_PRINT 4
#define UFUNC_ERR_LOG 5
- /* Python side integer mask */
+ /* Python side integer mask */
#define UFUNC_MASK_DIVIDEBYZERO 0x07
#define UFUNC_MASK_OVERFLOW 0x3f
@@ -76,64 +76,64 @@ typedef struct {
(UFUNC_ERR_PRINT << UFUNC_SHIFT_OVERFLOW) + \
(UFUNC_ERR_PRINT << UFUNC_SHIFT_INVALID)
- /* Only internal -- not exported, yet*/
+ /* Only internal -- not exported, yet*/
typedef struct {
- /* Multi-iterator portion --- needs to be present in this order
- to work with PyArray_Broadcast */
- PyObject_HEAD
- int numiter;
- npy_intp size;
- npy_intp index;
- int nd;
- npy_intp dimensions[NPY_MAXDIMS];
- PyArrayIterObject *iters[NPY_MAXARGS];
+ /* Multi-iterator portion --- needs to be present in this order
+ to work with PyArray_Broadcast */
+ PyObject_HEAD
+ int numiter;
+ npy_intp size;
+ npy_intp index;
+ int nd;
+ npy_intp dimensions[NPY_MAXDIMS];
+ PyArrayIterObject *iters[NPY_MAXARGS];
/* End of Multi-iterator portion */
- /* The ufunc */
- PyUFuncObject *ufunc;
+ /* The ufunc */
+ PyUFuncObject *ufunc;
- /* The error handling */
- int errormask; /* Integer showing desired error handling */
- PyObject *errobj; /* currently a tuple with
- (string, func or obj with write method or None)
- */
+ /* The error handling */
+ int errormask; /* Integer showing desired error handling */
+ PyObject *errobj; /* currently a tuple with
+ (string, func or obj with write method or None)
+ */
int first;
- /* Specific function and data to use */
- PyUFuncGenericFunction function;
- void *funcdata;
+ /* Specific function and data to use */
+ PyUFuncGenericFunction function;
+ void *funcdata;
- /* Loop method */
- int meth;
+ /* Loop method */
+ int meth;
- /* Whether we need to copy to a buffer or not.*/
- int needbuffer[NPY_MAXARGS];
- int leftover;
- int ninnerloops;
- int lastdim;
+ /* Whether we need to copy to a buffer or not.*/
+ int needbuffer[NPY_MAXARGS];
+ int leftover;
+ int ninnerloops;
+ int lastdim;
- /* Whether or not to swap */
- int swap[NPY_MAXARGS];
+ /* Whether or not to swap */
+ int swap[NPY_MAXARGS];
- /* Buffers for the loop */
- char *buffer[NPY_MAXARGS];
- int bufsize;
- npy_intp bufcnt;
- char *dptr[NPY_MAXARGS];
+ /* Buffers for the loop */
+ char *buffer[NPY_MAXARGS];
+ int bufsize;
+ npy_intp bufcnt;
+ char *dptr[NPY_MAXARGS];
- /* For casting */
- char *castbuf[NPY_MAXARGS];
- PyArray_VectorUnaryFunc *cast[NPY_MAXARGS];
+ /* For casting */
+ char *castbuf[NPY_MAXARGS];
+ PyArray_VectorUnaryFunc *cast[NPY_MAXARGS];
- /* usually points to buffer but when a cast is to be
- done it switches for that argument to castbuf.
- */
- char *bufptr[NPY_MAXARGS];
+ /* usually points to buffer but when a cast is to be
+ done it switches for that argument to castbuf.
+ */
+ char *bufptr[NPY_MAXARGS];
- /* Steps filled in from iters or sizeof(item)
- depending on loop method.
- */
- npy_intp steps[NPY_MAXARGS];
+ /* Steps filled in from iters or sizeof(item)
+ depending on loop method.
+ */
+ npy_intp steps[NPY_MAXARGS];
int obj; /* This loop uses object arrays or needs the Python API */
/* Flags: UFUNC_OBJ_ISOBJECT, UFUNC_OBJ_NEEDS_API */
@@ -154,18 +154,18 @@ typedef struct {
PyObject_HEAD
PyArrayIterObject *it;
PyArrayObject *ret;
- PyArrayIterObject *rit; /* Needed for Accumulate */
+ PyArrayIterObject *rit; /* Needed for Accumulate */
int outsize;
- npy_intp index;
- npy_intp size;
+ npy_intp index;
+ npy_intp size;
char idptr[UFUNC_MAXIDENTITY];
- /* The ufunc */
- PyUFuncObject *ufunc;
+ /* The ufunc */
+ PyUFuncObject *ufunc;
- /* The error handling */
- int errormask;
- PyObject *errobj;
+ /* The error handling */
+ int errormask;
+ PyObject *errobj;
int first;
PyUFuncGenericFunction function;
@@ -236,12 +236,12 @@ typedef struct _loop1d_info {
#define UFUNC_PYVALS_NAME "UFUNC_PYVALS"
#define UFUNC_CHECK_ERROR(arg) \
- do {if ((((arg)->obj & UFUNC_OBJ_NEEDS_API) && PyErr_Occurred()) || \
+ do {if ((((arg)->obj & UFUNC_OBJ_NEEDS_API) && PyErr_Occurred()) || \
((arg)->errormask && \
PyUFunc_checkfperr((arg)->errormask, \
(arg)->errobj, \
&(arg)->first))) \
- goto fail;} while (0)
+ goto fail;} while (0)
/* This code checks the IEEE status flags in a platform-dependent way */
/* Adapted from Numarray */
@@ -255,17 +255,17 @@ typedef struct _loop1d_info {
#include <machine/fpu.h>
-#define UFUNC_CHECK_STATUS(ret) { \
- unsigned long fpstatus; \
- \
- fpstatus = ieee_get_fp_control(); \
- /* clear status bits as well as disable exception mode if on */ \
- ieee_set_fp_control( 0 ); \
- ret = ((IEEE_STATUS_DZE & fpstatus) ? UFUNC_FPE_DIVIDEBYZERO : 0) \
- | ((IEEE_STATUS_OVF & fpstatus) ? UFUNC_FPE_OVERFLOW : 0) \
- | ((IEEE_STATUS_UNF & fpstatus) ? UFUNC_FPE_UNDERFLOW : 0) \
- | ((IEEE_STATUS_INV & fpstatus) ? UFUNC_FPE_INVALID : 0); \
- }
+#define UFUNC_CHECK_STATUS(ret) { \
+ unsigned long fpstatus; \
+ \
+ fpstatus = ieee_get_fp_control(); \
+ /* clear status bits as well as disable exception mode if on */ \
+ ieee_set_fp_control( 0 ); \
+ ret = ((IEEE_STATUS_DZE & fpstatus) ? UFUNC_FPE_DIVIDEBYZERO : 0) \
+ | ((IEEE_STATUS_OVF & fpstatus) ? UFUNC_FPE_OVERFLOW : 0) \
+ | ((IEEE_STATUS_UNF & fpstatus) ? UFUNC_FPE_UNDERFLOW : 0) \
+ | ((IEEE_STATUS_INV & fpstatus) ? UFUNC_FPE_INVALID : 0); \
+ }
/* MS Windows -----------------------------------------------------*/
#elif defined(_MSC_VER)
@@ -277,14 +277,14 @@ typedef struct _loop1d_info {
#define UFUNC_NOFPE _control87(MCW_EM, MCW_EM);
#endif
-#define UFUNC_CHECK_STATUS(ret) { \
- int fpstatus = (int) _clearfp(); \
- \
- ret = ((SW_ZERODIVIDE & fpstatus) ? UFUNC_FPE_DIVIDEBYZERO : 0) \
- | ((SW_OVERFLOW & fpstatus) ? UFUNC_FPE_OVERFLOW : 0) \
- | ((SW_UNDERFLOW & fpstatus) ? UFUNC_FPE_UNDERFLOW : 0) \
- | ((SW_INVALID & fpstatus) ? UFUNC_FPE_INVALID : 0); \
- }
+#define UFUNC_CHECK_STATUS(ret) { \
+ int fpstatus = (int) _clearfp(); \
+ \
+ ret = ((SW_ZERODIVIDE & fpstatus) ? UFUNC_FPE_DIVIDEBYZERO : 0) \
+ | ((SW_OVERFLOW & fpstatus) ? UFUNC_FPE_OVERFLOW : 0) \
+ | ((SW_UNDERFLOW & fpstatus) ? UFUNC_FPE_UNDERFLOW : 0) \
+ | ((SW_INVALID & fpstatus) ? UFUNC_FPE_INVALID : 0); \
+ }
/* Solaris --------------------------------------------------------*/
/* --------ignoring SunOS ieee_flags approach, someone else can
@@ -292,16 +292,16 @@ typedef struct _loop1d_info {
#elif defined(sun) || defined(__BSD__) || defined(__OpenBSD__) || (defined(__FreeBSD__) && (__FreeBSD_version < 502114)) || defined(__NetBSD__)
#include <ieeefp.h>
-#define UFUNC_CHECK_STATUS(ret) { \
- int fpstatus; \
- \
- fpstatus = (int) fpgetsticky(); \
- ret = ((FP_X_DZ & fpstatus) ? UFUNC_FPE_DIVIDEBYZERO : 0) \
- | ((FP_X_OFL & fpstatus) ? UFUNC_FPE_OVERFLOW : 0) \
- | ((FP_X_UFL & fpstatus) ? UFUNC_FPE_UNDERFLOW : 0) \
- | ((FP_X_INV & fpstatus) ? UFUNC_FPE_INVALID : 0); \
- (void) fpsetsticky(0); \
- }
+#define UFUNC_CHECK_STATUS(ret) { \
+ int fpstatus; \
+ \
+ fpstatus = (int) fpgetsticky(); \
+ ret = ((FP_X_DZ & fpstatus) ? UFUNC_FPE_DIVIDEBYZERO : 0) \
+ | ((FP_X_OFL & fpstatus) ? UFUNC_FPE_OVERFLOW : 0) \
+ | ((FP_X_UFL & fpstatus) ? UFUNC_FPE_UNDERFLOW : 0) \
+ | ((FP_X_INV & fpstatus) ? UFUNC_FPE_INVALID : 0); \
+ (void) fpsetsticky(0); \
+ }
#elif defined(__GLIBC__) || defined(__APPLE__) || defined(__CYGWIN__) || defined(__MINGW32__) || (defined(__FreeBSD__) && (__FreeBSD_version >= 502114))
@@ -312,14 +312,14 @@ typedef struct _loop1d_info {
#endif
#define UFUNC_CHECK_STATUS(ret) { \
- int fpstatus = (int) fetestexcept(FE_DIVBYZERO | FE_OVERFLOW | \
- FE_UNDERFLOW | FE_INVALID); \
- ret = ((FE_DIVBYZERO & fpstatus) ? UFUNC_FPE_DIVIDEBYZERO : 0) \
- | ((FE_OVERFLOW & fpstatus) ? UFUNC_FPE_OVERFLOW : 0) \
- | ((FE_UNDERFLOW & fpstatus) ? UFUNC_FPE_UNDERFLOW : 0) \
- | ((FE_INVALID & fpstatus) ? UFUNC_FPE_INVALID : 0); \
- (void) feclearexcept(FE_DIVBYZERO | FE_OVERFLOW | \
- FE_UNDERFLOW | FE_INVALID); \
+ int fpstatus = (int) fetestexcept(FE_DIVBYZERO | FE_OVERFLOW | \
+ FE_UNDERFLOW | FE_INVALID); \
+ ret = ((FE_DIVBYZERO & fpstatus) ? UFUNC_FPE_DIVIDEBYZERO : 0) \
+ | ((FE_OVERFLOW & fpstatus) ? UFUNC_FPE_OVERFLOW : 0) \
+ | ((FE_UNDERFLOW & fpstatus) ? UFUNC_FPE_UNDERFLOW : 0) \
+ | ((FE_INVALID & fpstatus) ? UFUNC_FPE_INVALID : 0); \
+ (void) feclearexcept(FE_DIVBYZERO | FE_OVERFLOW | \
+ FE_UNDERFLOW | FE_INVALID); \
}
#define generate_divbyzero_error() feraiseexcept(FE_DIVBYZERO)
@@ -331,14 +331,14 @@ typedef struct _loop1d_info {
#include <fpxcp.h>
#define UFUNC_CHECK_STATUS(ret) { \
- fpflag_t fpstatus; \
+ fpflag_t fpstatus; \
\
- fpstatus = fp_read_flag(); \
- ret = ((FP_DIV_BY_ZERO & fpstatus) ? UFUNC_FPE_DIVIDEBYZERO : 0) \
- | ((FP_OVERFLOW & fpstatus) ? UFUNC_FPE_OVERFLOW : 0) \
- | ((FP_UNDERFLOW & fpstatus) ? UFUNC_FPE_UNDERFLOW : 0) \
- | ((FP_INVALID & fpstatus) ? UFUNC_FPE_INVALID : 0); \
- fp_swap_flag(0); \
+ fpstatus = fp_read_flag(); \
+ ret = ((FP_DIV_BY_ZERO & fpstatus) ? UFUNC_FPE_DIVIDEBYZERO : 0) \
+ | ((FP_OVERFLOW & fpstatus) ? UFUNC_FPE_OVERFLOW : 0) \
+ | ((FP_UNDERFLOW & fpstatus) ? UFUNC_FPE_UNDERFLOW : 0) \
+ | ((FP_INVALID & fpstatus) ? UFUNC_FPE_INVALID : 0); \
+ fp_swap_flag(0); \
}
#define generate_divbyzero_error() fp_raise_xcp(FP_DIV_BY_ZERO)
@@ -348,7 +348,7 @@ typedef struct _loop1d_info {
#define NO_FLOATING_POINT_SUPPORT
#define UFUNC_CHECK_STATUS(ret) { \
- ret = 0; \
+ ret = 0; \
}
#endif
@@ -361,27 +361,27 @@ typedef struct _loop1d_info {
#if !defined(generate_divbyzero_error)
static int numeric_zero2 = 0;
static void generate_divbyzero_error(void) {
- double dummy;
- dummy = 1./numeric_zero2;
+ double dummy;
+ dummy = 1./numeric_zero2;
if (dummy) /* to prevent optimizer from eliminating expression */
- return;
- else /* should never be called */
- numeric_zero2 += 1;
- return;
+ return;
+ else /* should never be called */
+ numeric_zero2 += 1;
+ return;
}
#endif
#if !defined(generate_overflow_error)
static double numeric_two = 2.0;
static void generate_overflow_error(void) {
- double dummy;
- dummy = pow(numeric_two,1000);
+ double dummy;
+ dummy = pow(numeric_two,1000);
if (dummy)
return;
else
numeric_two += 0.1;
return;
- return;
+ return;
}
#endif
diff --git a/numpy/core/include/numpy/utils.h b/numpy/core/include/numpy/utils.h
index eb9fb5aa7..cc968a354 100644
--- a/numpy/core/include/numpy/utils.h
+++ b/numpy/core/include/numpy/utils.h
@@ -2,13 +2,13 @@
#define __NUMPY_UTILS_HEADER__
#ifndef __COMP_NPY_UNUSED
- #if defined(__GNUC__)
- #define __COMP_NPY_UNUSED __attribute__ ((__unused__))
- # elif defined(__ICC)
- #define __COMP_NPY_UNUSED __attribute__ ((__unused__))
- #else
- #define __COMP_NPY_UNUSED
- #endif
+ #if defined(__GNUC__)
+ #define __COMP_NPY_UNUSED __attribute__ ((__unused__))
+ # elif defined(__ICC)
+ #define __COMP_NPY_UNUSED __attribute__ ((__unused__))
+ #else
+ #define __COMP_NPY_UNUSED
+ #endif
#endif
/* Use this to tag a variable as not used. It will remove unused variable