diff options
70 files changed, 353 insertions, 378 deletions
diff --git a/numpy/core/code_generators/generate_ufunc_api.py b/numpy/core/code_generators/generate_ufunc_api.py index 04c023675..31c713f25 100644 --- a/numpy/core/code_generators/generate_ufunc_api.py +++ b/numpy/core/code_generators/generate_ufunc_api.py @@ -30,7 +30,7 @@ static void **PyUFunc_API=NULL; %s -static NPY_INLINE int +static inline int _import_umath(void) { PyObject *numpy = PyImport_ImportModule("numpy.core._multiarray_umath"); diff --git a/numpy/core/include/numpy/_neighborhood_iterator_imp.h b/numpy/core/include/numpy/_neighborhood_iterator_imp.h index 07e2363d0..b365cb508 100644 --- a/numpy/core/include/numpy/_neighborhood_iterator_imp.h +++ b/numpy/core/include/numpy/_neighborhood_iterator_imp.h @@ -4,7 +4,7 @@ /* * Private API (here for inline) */ -static NPY_INLINE int +static inline int _PyArrayNeighborhoodIter_IncrCoord(PyArrayNeighborhoodIterObject* iter); /* @@ -34,7 +34,7 @@ _PyArrayNeighborhoodIter_IncrCoord(PyArrayNeighborhoodIterObject* iter); iter->coordinates[c] = iter->bounds[c][0]; \ } -static NPY_INLINE int +static inline int _PyArrayNeighborhoodIter_IncrCoord(PyArrayNeighborhoodIterObject* iter) { npy_intp i, wb; @@ -49,7 +49,7 @@ _PyArrayNeighborhoodIter_IncrCoord(PyArrayNeighborhoodIterObject* iter) /* * Version optimized for 2d arrays, manual loop unrolling */ -static NPY_INLINE int +static inline int _PyArrayNeighborhoodIter_IncrCoord2D(PyArrayNeighborhoodIterObject* iter) { npy_intp wb; @@ -64,7 +64,7 @@ _PyArrayNeighborhoodIter_IncrCoord2D(PyArrayNeighborhoodIterObject* iter) /* * Advance to the next neighbour */ -static NPY_INLINE int +static inline int PyArrayNeighborhoodIter_Next(PyArrayNeighborhoodIterObject* iter) { _PyArrayNeighborhoodIter_IncrCoord (iter); @@ -76,7 +76,7 @@ PyArrayNeighborhoodIter_Next(PyArrayNeighborhoodIterObject* iter) /* * Reset functions */ -static NPY_INLINE int +static inline int PyArrayNeighborhoodIter_Reset(PyArrayNeighborhoodIterObject* iter) { npy_intp i; diff --git a/numpy/core/include/numpy/experimental_dtype_api.h b/numpy/core/include/numpy/experimental_dtype_api.h index 1fbd41981..5f5f24317 100644 --- a/numpy/core/include/numpy/experimental_dtype_api.h +++ b/numpy/core/include/numpy/experimental_dtype_api.h @@ -392,7 +392,7 @@ typedef PyArray_Descr *__get_default_descr( #define _PyArray_GetDefaultDescr \ ((__get_default_descr *)(__experimental_dtype_api_table[6])) -static NPY_INLINE PyArray_Descr * +static inline PyArray_Descr * PyArray_GetDefaultDescr(PyArray_DTypeMeta *DType) { if (DType->singleton != NULL) { diff --git a/numpy/core/include/numpy/ndarrayobject.h b/numpy/core/include/numpy/ndarrayobject.h index aaaefd7de..36cfdd6f6 100644 --- a/numpy/core/include/numpy/ndarrayobject.h +++ b/numpy/core/include/numpy/ndarrayobject.h @@ -152,7 +152,7 @@ extern "C" { (k)*PyArray_STRIDES(obj)[2] + \ (l)*PyArray_STRIDES(obj)[3])) -static NPY_INLINE void +static inline void PyArray_DiscardWritebackIfCopy(PyArrayObject *arr) { PyArrayObject_fields *fa = (PyArrayObject_fields *)arr; @@ -214,7 +214,7 @@ PyArray_DiscardWritebackIfCopy(PyArrayObject *arr) dict). */ -static NPY_INLINE int +static inline int NPY_TITLE_KEY_check(PyObject *key, PyObject *value) { PyObject *title; diff --git a/numpy/core/include/numpy/ndarraytypes.h b/numpy/core/include/numpy/ndarraytypes.h index e894b08f6..45ecb6955 100644 --- a/numpy/core/include/numpy/ndarraytypes.h +++ b/numpy/core/include/numpy/ndarraytypes.h @@ -1463,12 +1463,12 @@ typedef struct { */ /* General: those work for any mode */ -static NPY_INLINE int +static inline int PyArrayNeighborhoodIter_Reset(PyArrayNeighborhoodIterObject* iter); -static NPY_INLINE int +static inline int PyArrayNeighborhoodIter_Next(PyArrayNeighborhoodIterObject* iter); #if 0 -static NPY_INLINE int +static inline int PyArrayNeighborhoodIter_Next2D(PyArrayNeighborhoodIterObject* iter); #endif @@ -1514,85 +1514,85 @@ PyArrayNeighborhoodIter_Next2D(PyArrayNeighborhoodIterObject* iter); * ABI compatibility. */ -static NPY_INLINE int +static inline int PyArray_NDIM(const PyArrayObject *arr) { return ((PyArrayObject_fields *)arr)->nd; } -static NPY_INLINE void * +static inline void * PyArray_DATA(PyArrayObject *arr) { return ((PyArrayObject_fields *)arr)->data; } -static NPY_INLINE char * +static inline char * PyArray_BYTES(PyArrayObject *arr) { return ((PyArrayObject_fields *)arr)->data; } -static NPY_INLINE npy_intp * +static inline npy_intp * PyArray_DIMS(PyArrayObject *arr) { return ((PyArrayObject_fields *)arr)->dimensions; } -static NPY_INLINE npy_intp * +static inline npy_intp * PyArray_STRIDES(PyArrayObject *arr) { return ((PyArrayObject_fields *)arr)->strides; } -static NPY_INLINE npy_intp +static inline npy_intp PyArray_DIM(const PyArrayObject *arr, int idim) { return ((PyArrayObject_fields *)arr)->dimensions[idim]; } -static NPY_INLINE npy_intp +static inline npy_intp PyArray_STRIDE(const PyArrayObject *arr, int istride) { return ((PyArrayObject_fields *)arr)->strides[istride]; } -static NPY_INLINE NPY_RETURNS_BORROWED_REF PyObject * +static inline NPY_RETURNS_BORROWED_REF PyObject * PyArray_BASE(PyArrayObject *arr) { return ((PyArrayObject_fields *)arr)->base; } -static NPY_INLINE NPY_RETURNS_BORROWED_REF PyArray_Descr * +static inline NPY_RETURNS_BORROWED_REF PyArray_Descr * PyArray_DESCR(PyArrayObject *arr) { return ((PyArrayObject_fields *)arr)->descr; } -static NPY_INLINE int +static inline int PyArray_FLAGS(const PyArrayObject *arr) { return ((PyArrayObject_fields *)arr)->flags; } -static NPY_INLINE npy_intp +static inline npy_intp PyArray_ITEMSIZE(const PyArrayObject *arr) { return ((PyArrayObject_fields *)arr)->descr->elsize; } -static NPY_INLINE int +static inline int PyArray_TYPE(const PyArrayObject *arr) { return ((PyArrayObject_fields *)arr)->descr->type_num; } -static NPY_INLINE int +static inline int PyArray_CHKFLAGS(const PyArrayObject *arr, int flags) { return (PyArray_FLAGS(arr) & flags) == flags; } -static NPY_INLINE PyObject * +static inline PyObject * PyArray_GETITEM(const PyArrayObject *arr, const char *itemptr) { return ((PyArrayObject_fields *)arr)->descr->f->getitem( @@ -1604,7 +1604,7 @@ PyArray_GETITEM(const PyArrayObject *arr, const char *itemptr) * and of a type understood by the arrays dtype. * Use `PyArray_Pack` if the value may be of a different dtype. */ -static NPY_INLINE int +static inline int PyArray_SETITEM(PyArrayObject *arr, char *itemptr, PyObject *v) { return ((PyArrayObject_fields *)arr)->descr->f->setitem(v, itemptr, arr); @@ -1639,13 +1639,13 @@ PyArray_SETITEM(PyArrayObject *arr, char *itemptr, PyObject *v) (PyArrayObject *)(obj)) #endif -static NPY_INLINE PyArray_Descr * +static inline PyArray_Descr * PyArray_DTYPE(PyArrayObject *arr) { return ((PyArrayObject_fields *)arr)->descr; } -static NPY_INLINE npy_intp * +static inline npy_intp * PyArray_SHAPE(PyArrayObject *arr) { return ((PyArrayObject_fields *)arr)->dimensions; @@ -1655,7 +1655,7 @@ PyArray_SHAPE(PyArrayObject *arr) * Enables the specified array flags. Does no checking, * assumes you know what you're doing. */ -static NPY_INLINE void +static inline void PyArray_ENABLEFLAGS(PyArrayObject *arr, int flags) { ((PyArrayObject_fields *)arr)->flags |= flags; @@ -1665,13 +1665,13 @@ PyArray_ENABLEFLAGS(PyArrayObject *arr, int flags) * Clears the specified array flags. Does no checking, * assumes you know what you're doing. */ -static NPY_INLINE void +static inline void PyArray_CLEARFLAGS(PyArrayObject *arr, int flags) { ((PyArrayObject_fields *)arr)->flags &= ~flags; } -static NPY_INLINE NPY_RETURNS_BORROWED_REF PyObject * +static inline NPY_RETURNS_BORROWED_REF PyObject * PyArray_HANDLER(PyArrayObject *arr) { return ((PyArrayObject_fields *)arr)->mem_handler; diff --git a/numpy/core/include/numpy/npy_3kcompat.h b/numpy/core/include/numpy/npy_3kcompat.h index 11cc47765..8e5e4000a 100644 --- a/numpy/core/include/numpy/npy_3kcompat.h +++ b/numpy/core/include/numpy/npy_3kcompat.h @@ -36,7 +36,7 @@ extern "C" { * included here because it is missing from the PyPy API. It completes the PyLong_As* * group of functions and can be useful in replacing PyInt_Check. */ -static NPY_INLINE int +static inline int Npy__PyLong_AsInt(PyObject *obj) { int overflow; @@ -56,7 +56,7 @@ Npy__PyLong_AsInt(PyObject *obj) #if defined(NPY_PY3K) /* Return True only if the long fits in a C long */ -static NPY_INLINE int PyInt_Check(PyObject *op) { +static inline int PyInt_Check(PyObject *op) { int overflow = 0; if (!PyLong_Check(op)) { return 0; @@ -99,32 +99,6 @@ static NPY_INLINE int PyInt_Check(PyObject *op) { #define Npy_EnterRecursiveCall(x) Py_EnterRecursiveCall(x) -/* Py_SETREF was added in 3.5.2, and only if Py_LIMITED_API is absent */ -#if PY_VERSION_HEX < 0x03050200 - #define Py_SETREF(op, op2) \ - do { \ - PyObject *_py_tmp = (PyObject *)(op); \ - (op) = (op2); \ - Py_DECREF(_py_tmp); \ - } while (0) -#endif - -/* introduced in https://github.com/python/cpython/commit/a24107b04c1277e3c1105f98aff5bfa3a98b33a0 */ -#if PY_VERSION_HEX < 0x030800A3 - static NPY_INLINE PyObject * - _PyDict_GetItemStringWithError(PyObject *v, const char *key) - { - PyObject *kv, *rv; - kv = PyUnicode_FromString(key); - if (kv == NULL) { - return NULL; - } - rv = PyDict_GetItemWithError(v, kv); - Py_DECREF(kv); - return rv; - } -#endif - /* * PyString -> PyBytes */ @@ -194,14 +168,14 @@ static NPY_INLINE int PyInt_Check(PyObject *op) { #endif /* NPY_PY3K */ -static NPY_INLINE void +static inline void PyUnicode_ConcatAndDel(PyObject **left, PyObject *right) { Py_SETREF(*left, PyUnicode_Concat(*left, right)); Py_DECREF(right); } -static NPY_INLINE void +static inline void PyUnicode_Concat2(PyObject **left, PyObject *right) { Py_SETREF(*left, PyUnicode_Concat(*left, right)); @@ -214,7 +188,7 @@ PyUnicode_Concat2(PyObject **left, PyObject *right) /* * Get a FILE* handle to the file represented by the Python object */ -static NPY_INLINE FILE* +static inline FILE* npy_PyFile_Dup2(PyObject *file, char *mode, npy_off_t *orig_pos) { int fd, fd2, unbuf; @@ -330,7 +304,7 @@ npy_PyFile_Dup2(PyObject *file, char *mode, npy_off_t *orig_pos) /* * Close the dup-ed file handle, and seek the Python one to the current position */ -static NPY_INLINE int +static inline int npy_PyFile_DupClose2(PyObject *file, FILE* handle, npy_off_t orig_pos) { int fd, unbuf; @@ -397,7 +371,7 @@ npy_PyFile_DupClose2(PyObject *file, FILE* handle, npy_off_t orig_pos) return 0; } -static NPY_INLINE int +static inline int npy_PyFile_Check(PyObject *file) { int fd; @@ -415,7 +389,7 @@ npy_PyFile_Check(PyObject *file) return 1; } -static NPY_INLINE PyObject* +static inline PyObject* npy_PyFile_OpenFile(PyObject *filename, const char *mode) { PyObject *open; @@ -426,7 +400,7 @@ npy_PyFile_OpenFile(PyObject *filename, const char *mode) return PyObject_CallFunction(open, "Os", filename, mode); } -static NPY_INLINE int +static inline int npy_PyFile_CloseFile(PyObject *file) { PyObject *ret; @@ -442,7 +416,7 @@ npy_PyFile_CloseFile(PyObject *file) /* This is a copy of _PyErr_ChainExceptions */ -static NPY_INLINE void +static inline void npy_PyErr_ChainExceptions(PyObject *exc, PyObject *val, PyObject *tb) { if (exc == NULL) @@ -474,7 +448,7 @@ npy_PyErr_ChainExceptions(PyObject *exc, PyObject *val, PyObject *tb) * - a minimal implementation for python 2 * - __cause__ used instead of __context__ */ -static NPY_INLINE void +static inline void npy_PyErr_ChainExceptionsCause(PyObject *exc, PyObject *val, PyObject *tb) { if (exc == NULL) @@ -505,7 +479,7 @@ npy_PyErr_ChainExceptionsCause(PyObject *exc, PyObject *val, PyObject *tb) * PyObject_Cmp */ #if defined(NPY_PY3K) -static NPY_INLINE int +static inline int PyObject_Cmp(PyObject *i1, PyObject *i2, int *cmp) { int v; @@ -545,7 +519,7 @@ PyObject_Cmp(PyObject *i1, PyObject *i2, int *cmp) * The main job here is to get rid of the improved error handling * of PyCapsules. It's a shame... */ -static NPY_INLINE PyObject * +static inline PyObject * NpyCapsule_FromVoidPtr(void *ptr, void (*dtor)(PyObject *)) { PyObject *ret = PyCapsule_New(ptr, NULL, dtor); @@ -555,7 +529,7 @@ NpyCapsule_FromVoidPtr(void *ptr, void (*dtor)(PyObject *)) return ret; } -static NPY_INLINE PyObject * +static inline PyObject * NpyCapsule_FromVoidPtrAndDesc(void *ptr, void* context, void (*dtor)(PyObject *)) { PyObject *ret = NpyCapsule_FromVoidPtr(ptr, dtor); @@ -567,7 +541,7 @@ NpyCapsule_FromVoidPtrAndDesc(void *ptr, void* context, void (*dtor)(PyObject *) return ret; } -static NPY_INLINE void * +static inline void * NpyCapsule_AsVoidPtr(PyObject *obj) { void *ret = PyCapsule_GetPointer(obj, NULL); @@ -577,13 +551,13 @@ NpyCapsule_AsVoidPtr(PyObject *obj) return ret; } -static NPY_INLINE void * +static inline void * NpyCapsule_GetDesc(PyObject *obj) { return PyCapsule_GetContext(obj); } -static NPY_INLINE int +static inline int NpyCapsule_Check(PyObject *ptr) { return PyCapsule_CheckExact(ptr); diff --git a/numpy/core/include/numpy/npy_common.h b/numpy/core/include/numpy/npy_common.h index 2bcc45e4f..ea4a818c8 100644 --- a/numpy/core/include/numpy/npy_common.h +++ b/numpy/core/include/numpy/npy_common.h @@ -131,6 +131,7 @@ #endif #endif +/* `NPY_INLINE` kept for backwards compatibility; use `inline` instead */ #if defined(_MSC_VER) && !defined(__clang__) #define NPY_INLINE __inline /* clang included here to handle clang-cl on Windows */ @@ -147,7 +148,7 @@ #ifdef _MSC_VER #define NPY_FINLINE static __forceinline #elif defined(__GNUC__) - #define NPY_FINLINE static NPY_INLINE __attribute__((always_inline)) + #define NPY_FINLINE static inline __attribute__((always_inline)) #else #define NPY_FINLINE static #endif diff --git a/numpy/core/include/numpy/npy_math.h b/numpy/core/include/numpy/npy_math.h index 27e1ddad0..945bbb15b 100644 --- a/numpy/core/include/numpy/npy_math.h +++ b/numpy/core/include/numpy/npy_math.h @@ -8,7 +8,7 @@ /* By adding static inline specifiers to npy_math function definitions when appropriate, compiler is given the opportunity to optimize */ #if NPY_INLINE_MATH -#define NPY_INPLACE NPY_INLINE static +#define NPY_INPLACE static inline #else #define NPY_INPLACE #endif @@ -24,25 +24,25 @@ extern "C" { * * XXX: I should test whether INFINITY and NAN are available on the platform */ -NPY_INLINE static float __npy_inff(void) +static inline float __npy_inff(void) { const union { npy_uint32 __i; float __f;} __bint = {0x7f800000UL}; return __bint.__f; } -NPY_INLINE static float __npy_nanf(void) +static inline float __npy_nanf(void) { const union { npy_uint32 __i; float __f;} __bint = {0x7fc00000UL}; return __bint.__f; } -NPY_INLINE static float __npy_pzerof(void) +static inline float __npy_pzerof(void) { const union { npy_uint32 __i; float __f;} __bint = {0x00000000UL}; return __bint.__f; } -NPY_INLINE static float __npy_nzerof(void) +static inline float __npy_nzerof(void) { const union { npy_uint32 __i; float __f;} __bint = {0x80000000UL}; return __bint.__f; @@ -399,17 +399,17 @@ NPY_INPLACE npy_longdouble npy_heavisidel(npy_longdouble x, npy_longdouble h0); \ return z1.z; -static NPY_INLINE npy_cdouble npy_cpack(double x, double y) +static inline npy_cdouble npy_cpack(double x, double y) { __NPY_CPACK_IMP(x, y, double, npy_cdouble); } -static NPY_INLINE npy_cfloat npy_cpackf(float x, float y) +static inline npy_cfloat npy_cpackf(float x, float y) { __NPY_CPACK_IMP(x, y, float, npy_cfloat); } -static NPY_INLINE npy_clongdouble npy_cpackl(npy_longdouble x, npy_longdouble y) +static inline npy_clongdouble npy_cpackl(npy_longdouble x, npy_longdouble y) { __NPY_CPACK_IMP(x, y, npy_longdouble, npy_clongdouble); } @@ -431,32 +431,32 @@ static NPY_INLINE npy_clongdouble npy_cpackl(npy_longdouble x, npy_longdouble y) \ return __z_repr.a[index]; -static NPY_INLINE double npy_creal(npy_cdouble z) +static inline double npy_creal(npy_cdouble z) { __NPY_CEXTRACT_IMP(z, 0, double, npy_cdouble); } -static NPY_INLINE double npy_cimag(npy_cdouble z) +static inline double npy_cimag(npy_cdouble z) { __NPY_CEXTRACT_IMP(z, 1, double, npy_cdouble); } -static NPY_INLINE float npy_crealf(npy_cfloat z) +static inline float npy_crealf(npy_cfloat z) { __NPY_CEXTRACT_IMP(z, 0, float, npy_cfloat); } -static NPY_INLINE float npy_cimagf(npy_cfloat z) +static inline float npy_cimagf(npy_cfloat z) { __NPY_CEXTRACT_IMP(z, 1, float, npy_cfloat); } -static NPY_INLINE npy_longdouble npy_creall(npy_clongdouble z) +static inline npy_longdouble npy_creall(npy_clongdouble z) { __NPY_CEXTRACT_IMP(z, 0, npy_longdouble, npy_clongdouble); } -static NPY_INLINE npy_longdouble npy_cimagl(npy_clongdouble z) +static inline npy_longdouble npy_cimagl(npy_clongdouble z) { __NPY_CEXTRACT_IMP(z, 1, npy_longdouble, npy_clongdouble); } diff --git a/numpy/core/include/numpy/random/distributions.h b/numpy/core/include/numpy/random/distributions.h index 78bd06ff5..e7fa4bd00 100644 --- a/numpy/core/include/numpy/random/distributions.h +++ b/numpy/core/include/numpy/random/distributions.h @@ -198,7 +198,7 @@ RAND_INT_TYPE random_binomial_inversion(bitgen_t *bitgen_state, double p, binomial_t *binomial); double random_loggam(double x); -static NPY_INLINE double next_double(bitgen_t *bitgen_state) { +static inline double next_double(bitgen_t *bitgen_state) { return bitgen_state->next_double(bitgen_state->state); } diff --git a/numpy/core/src/common/get_attr_string.h b/numpy/core/src/common/get_attr_string.h index 90eca5ee6..36d39189f 100644 --- a/numpy/core/src/common/get_attr_string.h +++ b/numpy/core/src/common/get_attr_string.h @@ -4,7 +4,7 @@ #include <Python.h> #include "ufunc_object.h" -static NPY_INLINE npy_bool +static inline npy_bool _is_basic_python_type(PyTypeObject *tp) { return ( @@ -46,7 +46,7 @@ _is_basic_python_type(PyTypeObject *tp) * * In future, could be made more like _Py_LookupSpecial */ -static NPY_INLINE PyObject * +static inline PyObject * PyArray_LookupSpecial(PyObject *obj, PyObject *name_unicode) { PyTypeObject *tp = Py_TYPE(obj); @@ -73,7 +73,7 @@ PyArray_LookupSpecial(PyObject *obj, PyObject *name_unicode) * * Kept for backwards compatibility. In future, we should deprecate this. */ -static NPY_INLINE PyObject * +static inline PyObject * PyArray_LookupSpecial_OnInstance(PyObject *obj, PyObject *name_unicode) { PyTypeObject *tp = Py_TYPE(obj); diff --git a/numpy/core/src/common/lowlevel_strided_loops.h b/numpy/core/src/common/lowlevel_strided_loops.h index 924a34db5..4ad110663 100644 --- a/numpy/core/src/common/lowlevel_strided_loops.h +++ b/numpy/core/src/common/lowlevel_strided_loops.h @@ -425,7 +425,7 @@ PyArray_PrepareThreeRawArrayIter(int ndim, npy_intp const *shape, * blocking. See the 'npy_blocked_end' function documentation below for an * example of how this function is used. */ -static NPY_INLINE npy_intp +static inline npy_intp npy_aligned_block_offset(const void * addr, const npy_uintp esize, const npy_uintp alignment, const npy_uintp nvals) { @@ -458,7 +458,7 @@ npy_aligned_block_offset(const void * addr, const npy_uintp esize, * for(; i < n; i++) * <scalar-op> */ -static NPY_INLINE npy_intp +static inline npy_intp npy_blocked_end(const npy_uintp peel, const npy_uintp esize, const npy_uintp vsz, const npy_uintp nvals) { @@ -472,7 +472,7 @@ npy_blocked_end(const npy_uintp peel, const npy_uintp esize, /* byte swapping functions */ -static NPY_INLINE npy_uint16 +static inline npy_uint16 npy_bswap2(npy_uint16 x) { return ((x & 0xffu) << 8) | (x >> 8); @@ -482,7 +482,7 @@ npy_bswap2(npy_uint16 x) * treat as int16 and byteswap unaligned memory, * some cpus don't support unaligned access */ -static NPY_INLINE void +static inline void npy_bswap2_unaligned(char * x) { char a = x[0]; @@ -490,7 +490,7 @@ npy_bswap2_unaligned(char * x) x[1] = a; } -static NPY_INLINE npy_uint32 +static inline npy_uint32 npy_bswap4(npy_uint32 x) { #ifdef HAVE___BUILTIN_BSWAP32 @@ -501,7 +501,7 @@ npy_bswap4(npy_uint32 x) #endif } -static NPY_INLINE void +static inline void npy_bswap4_unaligned(char * x) { char a = x[0]; @@ -512,7 +512,7 @@ npy_bswap4_unaligned(char * x) x[2] = a; } -static NPY_INLINE npy_uint64 +static inline npy_uint64 npy_bswap8(npy_uint64 x) { #ifdef HAVE___BUILTIN_BSWAP64 @@ -529,7 +529,7 @@ npy_bswap8(npy_uint64 x) #endif } -static NPY_INLINE void +static inline void npy_bswap8_unaligned(char * x) { char a = x[0]; x[0] = x[7]; x[7] = a; @@ -685,7 +685,7 @@ npy_bswap8_unaligned(char * x) size == 1 ? 0 : ((PyArray_NDIM(arr) == 1) ? \ PyArray_STRIDE(arr, 0) : PyArray_ITEMSIZE(arr))) -static NPY_INLINE int +static inline int PyArray_EQUIVALENTLY_ITERABLE_OVERLAP_OK(PyArrayObject *arr1, PyArrayObject *arr2, int arr1_read, int arr2_read) { diff --git a/numpy/core/src/common/npy_cblas.h b/numpy/core/src/common/npy_cblas.h index 30fec1a65..751854b6e 100644 --- a/numpy/core/src/common/npy_cblas.h +++ b/numpy/core/src/common/npy_cblas.h @@ -66,7 +66,7 @@ enum CBLAS_SIDE {CblasLeft=141, CblasRight=142}; * Convert NumPy stride to BLAS stride. Returns 0 if conversion cannot be done * (BLAS won't handle negative or zero strides the way we want). */ -static NPY_INLINE CBLAS_INT +static inline CBLAS_INT blas_stride(npy_intp stride, unsigned itemsize) { /* diff --git a/numpy/core/src/common/npy_ctypes.h b/numpy/core/src/common/npy_ctypes.h index 05761cad3..4b5634574 100644 --- a/numpy/core/src/common/npy_ctypes.h +++ b/numpy/core/src/common/npy_ctypes.h @@ -14,7 +14,7 @@ * This entire function is just a wrapper around the Python function of the * same name. */ -NPY_INLINE static int +static inline int npy_ctypes_check(PyTypeObject *obj) { static PyObject *py_func = NULL; diff --git a/numpy/core/src/common/npy_extint128.h b/numpy/core/src/common/npy_extint128.h index d563c2ac8..776d71c77 100644 --- a/numpy/core/src/common/npy_extint128.h +++ b/numpy/core/src/common/npy_extint128.h @@ -9,7 +9,7 @@ typedef struct { /* Integer addition with overflow checking */ -static NPY_INLINE npy_int64 +static inline npy_int64 safe_add(npy_int64 a, npy_int64 b, char *overflow_flag) { if (a > 0 && b > NPY_MAX_INT64 - a) { @@ -23,7 +23,7 @@ safe_add(npy_int64 a, npy_int64 b, char *overflow_flag) /* Integer subtraction with overflow checking */ -static NPY_INLINE npy_int64 +static inline npy_int64 safe_sub(npy_int64 a, npy_int64 b, char *overflow_flag) { if (a >= 0 && b < a - NPY_MAX_INT64) { @@ -37,7 +37,7 @@ safe_sub(npy_int64 a, npy_int64 b, char *overflow_flag) /* Integer multiplication with overflow checking */ -static NPY_INLINE npy_int64 +static inline npy_int64 safe_mul(npy_int64 a, npy_int64 b, char *overflow_flag) { if (a > 0) { @@ -58,7 +58,7 @@ safe_mul(npy_int64 a, npy_int64 b, char *overflow_flag) /* Long integer init */ -static NPY_INLINE npy_extint128_t +static inline npy_extint128_t to_128(npy_int64 x) { npy_extint128_t result; @@ -74,7 +74,7 @@ to_128(npy_int64 x) } -static NPY_INLINE npy_int64 +static inline npy_int64 to_64(npy_extint128_t x, char *overflow) { if (x.hi != 0 || @@ -87,7 +87,7 @@ to_64(npy_extint128_t x, char *overflow) /* Long integer multiply */ -static NPY_INLINE npy_extint128_t +static inline npy_extint128_t mul_64_64(npy_int64 a, npy_int64 b) { npy_extint128_t x, y, z; @@ -127,7 +127,7 @@ mul_64_64(npy_int64 a, npy_int64 b) /* Long integer add */ -static NPY_INLINE npy_extint128_t +static inline npy_extint128_t add_128(npy_extint128_t x, npy_extint128_t y, char *overflow) { npy_extint128_t z; @@ -170,7 +170,7 @@ add_128(npy_extint128_t x, npy_extint128_t y, char *overflow) /* Long integer negation */ -static NPY_INLINE npy_extint128_t +static inline npy_extint128_t neg_128(npy_extint128_t x) { npy_extint128_t z = x; @@ -179,14 +179,14 @@ neg_128(npy_extint128_t x) } -static NPY_INLINE npy_extint128_t +static inline npy_extint128_t sub_128(npy_extint128_t x, npy_extint128_t y, char *overflow) { return add_128(x, neg_128(y), overflow); } -static NPY_INLINE npy_extint128_t +static inline npy_extint128_t shl_128(npy_extint128_t v) { npy_extint128_t z; @@ -198,7 +198,7 @@ shl_128(npy_extint128_t v) } -static NPY_INLINE npy_extint128_t +static inline npy_extint128_t shr_128(npy_extint128_t v) { npy_extint128_t z; @@ -209,7 +209,7 @@ shr_128(npy_extint128_t v) return z; } -static NPY_INLINE int +static inline int gt_128(npy_extint128_t a, npy_extint128_t b) { if (a.sign > 0 && b.sign > 0) { @@ -228,7 +228,7 @@ gt_128(npy_extint128_t a, npy_extint128_t b) /* Long integer divide */ -static NPY_INLINE npy_extint128_t +static inline npy_extint128_t divmod_128_64(npy_extint128_t x, npy_int64 b, npy_int64 *mod) { npy_extint128_t remainder, pointer, result, divisor; @@ -284,7 +284,7 @@ divmod_128_64(npy_extint128_t x, npy_int64 b, npy_int64 *mod) /* Divide and round down (positive divisor; no overflows) */ -static NPY_INLINE npy_extint128_t +static inline npy_extint128_t floordiv_128_64(npy_extint128_t a, npy_int64 b) { npy_extint128_t result; @@ -300,7 +300,7 @@ floordiv_128_64(npy_extint128_t a, npy_int64 b) /* Divide and round up (positive divisor; no overflows) */ -static NPY_INLINE npy_extint128_t +static inline npy_extint128_t ceildiv_128_64(npy_extint128_t a, npy_int64 b) { npy_extint128_t result; diff --git a/numpy/core/src/common/npy_hashtable.c b/numpy/core/src/common/npy_hashtable.c index af82c0f85..14f6cca1b 100644 --- a/numpy/core/src/common/npy_hashtable.c +++ b/numpy/core/src/common/npy_hashtable.c @@ -35,7 +35,7 @@ * * Users cannot control pointers, so we do not have to worry about DoS attacks? */ -static NPY_INLINE Py_hash_t +static inline Py_hash_t identity_list_hash(PyObject *const *v, int len) { Py_uhash_t acc = _NpyHASH_XXPRIME_5; @@ -58,7 +58,7 @@ identity_list_hash(PyObject *const *v, int len) #undef _NpyHASH_XXROTATE -static NPY_INLINE PyObject ** +static inline PyObject ** find_item(PyArrayIdentityHash const *tb, PyObject *const *key) { Py_hash_t hash = identity_list_hash(key, tb->key_len); diff --git a/numpy/core/src/common/npy_import.h b/numpy/core/src/common/npy_import.h index f36b6924a..58b4ba0bc 100644 --- a/numpy/core/src/common/npy_import.h +++ b/numpy/core/src/common/npy_import.h @@ -16,7 +16,7 @@ * @param attr module attribute to cache. * @param cache Storage location for imported function. */ -NPY_INLINE static void +static inline void npy_cache_import(const char *module, const char *attr, PyObject **cache) { if (NPY_UNLIKELY(*cache == NULL)) { diff --git a/numpy/core/src/common/npy_pycompat.h b/numpy/core/src/common/npy_pycompat.h index 6641cd591..ce6c34fa1 100644 --- a/numpy/core/src/common/npy_pycompat.h +++ b/numpy/core/src/common/npy_pycompat.h @@ -11,7 +11,7 @@ #if PY_VERSION_HEX > 0x030a00a6 #define Npy_HashDouble _Py_HashDouble #else -static NPY_INLINE Py_hash_t +static inline Py_hash_t Npy_HashDouble(PyObject *NPY_UNUSED(identity), double val) { return _Py_HashDouble(val); diff --git a/numpy/core/src/common/npy_sort.h.src b/numpy/core/src/common/npy_sort.h.src index a3f556f56..d6e435722 100644 --- a/numpy/core/src/common/npy_sort.h.src +++ b/numpy/core/src/common/npy_sort.h.src @@ -9,7 +9,7 @@ #define NPY_ENOMEM 1 #define NPY_ECOMP 2 -static NPY_INLINE int npy_get_msb(npy_uintp unum) +static inline int npy_get_msb(npy_uintp unum) { int depth_limit = 0; while (unum >>= 1) { diff --git a/numpy/core/src/common/templ_common.h.src b/numpy/core/src/common/templ_common.h.src index 84e13481b..d0d1917fe 100644 --- a/numpy/core/src/common/templ_common.h.src +++ b/numpy/core/src/common/templ_common.h.src @@ -25,7 +25,7 @@ * that is not checked. Could use absolute values and adjust the sign if that * functionality was desired. */ -static NPY_INLINE int +static inline int npy_mul_with_overflow_@name@(@type@ * r, @type@ a, @type@ b) { #ifdef HAVE___BUILTIN_MUL_OVERFLOW @@ -52,7 +52,7 @@ npy_mul_with_overflow_@name@(@type@ * r, @type@ a, @type@ b) } /**end repeat**/ -static NPY_INLINE int +static inline int npy_mul_sizes_with_overflow (npy_intp * r, npy_intp a, npy_intp b) { #ifdef HAVE___BUILTIN_MUL_OVERFLOW diff --git a/numpy/core/src/multiarray/abstractdtypes.c b/numpy/core/src/multiarray/abstractdtypes.c index 8dc595738..da44fd01f 100644 --- a/numpy/core/src/multiarray/abstractdtypes.c +++ b/numpy/core/src/multiarray/abstractdtypes.c @@ -13,7 +13,7 @@ #include "common.h" -static NPY_INLINE PyArray_Descr * +static inline PyArray_Descr * int_default_descriptor(PyArray_DTypeMeta* NPY_UNUSED(cls)) { return PyArray_DescrFromType(NPY_LONG); @@ -51,7 +51,7 @@ discover_descriptor_from_pyint( } -static NPY_INLINE PyArray_Descr * +static inline PyArray_Descr * float_default_descriptor(PyArray_DTypeMeta* NPY_UNUSED(cls)) { return PyArray_DescrFromType(NPY_DOUBLE); @@ -66,7 +66,7 @@ discover_descriptor_from_pyfloat( return PyArray_DescrFromType(NPY_DOUBLE); } -static NPY_INLINE PyArray_Descr * +static inline PyArray_Descr * complex_default_descriptor(PyArray_DTypeMeta* NPY_UNUSED(cls)) { return PyArray_DescrFromType(NPY_CDOUBLE); diff --git a/numpy/core/src/multiarray/abstractdtypes.h b/numpy/core/src/multiarray/abstractdtypes.h index 6901ec213..b0850bd35 100644 --- a/numpy/core/src/multiarray/abstractdtypes.h +++ b/numpy/core/src/multiarray/abstractdtypes.h @@ -30,7 +30,7 @@ initialize_and_map_pytypes_to_dtypes(void); * replaced with the abstract DType. * @return 0 if the `obj` was not a python scalar, and 1 if it was. */ -static NPY_INLINE int +static inline int npy_mark_tmp_array_if_pyscalar( PyObject *obj, PyArrayObject *arr, PyArray_DTypeMeta **dtype) { diff --git a/numpy/core/src/multiarray/alloc.c b/numpy/core/src/multiarray/alloc.c index 8b765aa95..d3b8612f7 100644 --- a/numpy/core/src/multiarray/alloc.c +++ b/numpy/core/src/multiarray/alloc.c @@ -88,7 +88,7 @@ _set_madvise_hugepage(PyObject *NPY_UNUSED(self), PyObject *enabled_obj) * base function for data cache with 1 byte buckets and dimension cache with * sizeof(npy_intp) byte buckets */ -static NPY_INLINE void * +static inline void * _npy_alloc_cache(npy_uintp nelem, npy_uintp esz, npy_uint msz, cache_bucket * cache, void * (*alloc)(size_t)) { @@ -126,7 +126,7 @@ _npy_alloc_cache(npy_uintp nelem, npy_uintp esz, npy_uint msz, * return pointer p to cache, nelem is number of elements of the cache bucket * size (1 or sizeof(npy_intp)) of the block pointed too */ -static NPY_INLINE void +static inline void _npy_free_cache(void * p, npy_uintp nelem, npy_uint msz, cache_bucket * cache, void (*dealloc)(void *)) { @@ -206,7 +206,7 @@ npy_free_cache_dim(void * p, npy_uintp sz) } /* Similar to array_dealloc in arrayobject.c */ -static NPY_INLINE void +static inline void WARN_NO_RETURN(PyObject* warning, const char * msg) { if (PyErr_WarnEx(warning, msg, 1) < 0) { PyObject * s; @@ -364,7 +364,7 @@ PyDataMem_RENEW(void *ptr, size_t size) // The default data mem allocator malloc routine does not make use of a ctx. // It should be called only through PyDataMem_UserNEW // since itself does not handle eventhook and tracemalloc logic. -static NPY_INLINE void * +static inline void * default_malloc(void *NPY_UNUSED(ctx), size_t size) { return _npy_alloc_cache(size, 1, NBUCKETS, datacache, &malloc); @@ -373,7 +373,7 @@ default_malloc(void *NPY_UNUSED(ctx), size_t size) // The default data mem allocator calloc routine does not make use of a ctx. // It should be called only through PyDataMem_UserNEW_ZEROED // since itself does not handle eventhook and tracemalloc logic. -static NPY_INLINE void * +static inline void * default_calloc(void *NPY_UNUSED(ctx), size_t nelem, size_t elsize) { void * p; @@ -395,7 +395,7 @@ default_calloc(void *NPY_UNUSED(ctx), size_t nelem, size_t elsize) // The default data mem allocator realloc routine does not make use of a ctx. // It should be called only through PyDataMem_UserRENEW // since itself does not handle eventhook and tracemalloc logic. -static NPY_INLINE void * +static inline void * default_realloc(void *NPY_UNUSED(ctx), void *ptr, size_t new_size) { return realloc(ptr, new_size); @@ -404,7 +404,7 @@ default_realloc(void *NPY_UNUSED(ctx), void *ptr, size_t new_size) // The default data mem allocator free routine does not make use of a ctx. // It should be called only through PyDataMem_UserFREE // since itself does not handle eventhook and tracemalloc logic. -static NPY_INLINE void +static inline void default_free(void *NPY_UNUSED(ctx), void *ptr, size_t size) { _npy_free_cache(ptr, size, NBUCKETS, datacache, &free); diff --git a/numpy/core/src/multiarray/alloc.h b/numpy/core/src/multiarray/alloc.h index 0f5a7524c..186eb5487 100644 --- a/numpy/core/src/multiarray/alloc.h +++ b/numpy/core/src/multiarray/alloc.h @@ -31,13 +31,13 @@ npy_alloc_cache_dim(npy_uintp sz); NPY_NO_EXPORT void npy_free_cache_dim(void * p, npy_uintp sd); -static NPY_INLINE void +static inline void npy_free_cache_dim_obj(PyArray_Dims dims) { npy_free_cache_dim(dims.ptr, dims.len); } -static NPY_INLINE void +static inline void npy_free_cache_dim_array(PyArrayObject * arr) { npy_free_cache_dim(PyArray_DIMS(arr), PyArray_NDIM(arr)); diff --git a/numpy/core/src/multiarray/array_coercion.c b/numpy/core/src/multiarray/array_coercion.c index 0241fb82c..13d6682f7 100644 --- a/numpy/core/src/multiarray/array_coercion.c +++ b/numpy/core/src/multiarray/array_coercion.c @@ -209,7 +209,7 @@ _PyArray_MapPyTypeToDType( * @param pytype Python Type to look up * @return DType, None if it is a known non-scalar, or NULL if an unknown object. */ -static NPY_INLINE PyArray_DTypeMeta * +static inline PyArray_DTypeMeta * npy_discover_dtype_from_pytype(PyTypeObject *pytype) { PyObject *DType; @@ -262,7 +262,7 @@ PyArray_DiscoverDTypeFromScalarType(PyTypeObject *pytype) * it can/wants to handle the (possible) scalar value. * @return New reference to either a DType class, Py_None, or NULL on error. */ -static NPY_INLINE PyArray_DTypeMeta * +static inline PyArray_DTypeMeta * discover_dtype_from_pyobject( PyObject *obj, enum _dtype_discovery_flags *flags, PyArray_DTypeMeta *fixed_DType) @@ -346,7 +346,7 @@ discover_dtype_from_pyobject( * @param obj The Python scalar object. At the time of calling this function * it must be known that `obj` should represent a scalar. */ -static NPY_INLINE PyArray_Descr * +static inline PyArray_Descr * find_scalar_descriptor( PyArray_DTypeMeta *fixed_DType, PyArray_DTypeMeta *DType, PyObject *obj) @@ -611,7 +611,7 @@ static coercion_cache_obj *_coercion_cache_cache[COERCION_CACHE_CACHE_SIZE]; /* * Steals a reference to the object. */ -static NPY_INLINE int +static inline int npy_new_coercion_cache( PyObject *converted_obj, PyObject *arr_or_sequence, npy_bool sequence, coercion_cache_obj ***next_ptr, int ndim) @@ -681,7 +681,7 @@ npy_free_coercion_cache(coercion_cache_obj *next) { * @param flags dtype discover flags to signal failed promotion. * @return -1 on error, 0 on success. */ -static NPY_INLINE int +static inline int handle_promotion(PyArray_Descr **out_descr, PyArray_Descr *descr, PyArray_DTypeMeta *fixed_DType, enum _dtype_discovery_flags *flags) { @@ -726,7 +726,7 @@ handle_promotion(PyArray_Descr **out_descr, PyArray_Descr *descr, * * @return 0 on success -1 on error */ -static NPY_INLINE int +static inline int handle_scalar( PyObject *obj, int curr_dims, int *max_dims, PyArray_Descr **out_descr, npy_intp *out_shape, diff --git a/numpy/core/src/multiarray/array_method.c b/numpy/core/src/multiarray/array_method.c index ff74a4530..79c588f25 100644 --- a/numpy/core/src/multiarray/array_method.c +++ b/numpy/core/src/multiarray/array_method.c @@ -99,7 +99,7 @@ default_resolve_descriptors( } -NPY_INLINE static int +static inline int is_contiguous( npy_intp const *strides, PyArray_Descr *const *descriptors, int nargs) { diff --git a/numpy/core/src/multiarray/arrayobject.c b/numpy/core/src/multiarray/arrayobject.c index b1302738d..ceafffd51 100644 --- a/numpy/core/src/multiarray/arrayobject.c +++ b/numpy/core/src/multiarray/arrayobject.c @@ -394,7 +394,7 @@ PyArray_ResolveWritebackIfCopy(PyArrayObject * self) to stderr and clear the error */ -static NPY_INLINE void +static inline void WARN_IN_DEALLOC(PyObject* warning, const char * msg) { if (PyErr_WarnEx(warning, msg, 1) < 0) { PyObject * s; diff --git a/numpy/core/src/multiarray/arraytypes.c.src b/numpy/core/src/multiarray/arraytypes.c.src index c03d09784..3149ff36f 100644 --- a/numpy/core/src/multiarray/arraytypes.c.src +++ b/numpy/core/src/multiarray/arraytypes.c.src @@ -55,7 +55,7 @@ * This is especially important for nonzero and copyswap, which may run with * the GIL released. */ -static NPY_INLINE PyArrayObject_fields +static inline PyArrayObject_fields get_dummy_stack_array(PyArrayObject *orig) { PyArrayObject_fields new_fields; @@ -68,7 +68,7 @@ get_dummy_stack_array(PyArrayObject *orig) /* check for sequences, but ignore the types numpy considers scalars */ -static NPY_INLINE npy_bool +static inline npy_bool PySequence_NoString_Check(PyObject *op) { return PySequence_Check(op) && @@ -525,7 +525,7 @@ NPY_NO_EXPORT int /**end repeat**/ -static NPY_INLINE npy_longdouble +static inline npy_longdouble string_to_long_double(PyObject*op) { char *s; @@ -2152,7 +2152,7 @@ static int */ -static NPY_INLINE void +static inline void _basic_copyn(void *dst, npy_intp dstride, void *src, npy_intp sstride, npy_intp n, int elsize) { if (src == NULL) { @@ -2167,7 +2167,7 @@ _basic_copyn(void *dst, npy_intp dstride, void *src, npy_intp sstride, } } -static NPY_INLINE void +static inline void _basic_copy(void *dst, void *src, int elsize) { if (src == NULL) { return; diff --git a/numpy/core/src/multiarray/buffer.c b/numpy/core/src/multiarray/buffer.c index 0307d41a8..76652550a 100644 --- a/numpy/core/src/multiarray/buffer.c +++ b/numpy/core/src/multiarray/buffer.c @@ -136,7 +136,7 @@ fail: * AND, the descr element size is a multiple of the alignment, * AND, the array data is positioned to alignment granularity. */ -static NPY_INLINE int +static inline int _is_natively_aligned_at(PyArray_Descr *descr, PyArrayObject *arr, Py_ssize_t offset) { @@ -591,7 +591,7 @@ _buffer_info_cmp(_buffer_info_t *a, _buffer_info_t *b) * a useful error message instead of crashing hard if a C-subclass uses * the same field. */ -static NPY_INLINE void * +static inline void * buffer_info_tag(void *buffer_info) { if (buffer_info == NULL) { @@ -603,7 +603,7 @@ buffer_info_tag(void *buffer_info) } -static NPY_INLINE int +static inline int _buffer_info_untag( void *tagged_buffer_info, _buffer_info_t **buffer_info, PyObject *obj) { diff --git a/numpy/core/src/multiarray/common.h b/numpy/core/src/multiarray/common.h index 3de8c842d..e40edb0d2 100644 --- a/numpy/core/src/multiarray/common.h +++ b/numpy/core/src/multiarray/common.h @@ -103,7 +103,7 @@ _may_have_objects(PyArray_Descr *dtype); * If _save is not NULL it is assumed the GIL is not taken and it * is acquired in the case of an error */ -static NPY_INLINE int +static inline int check_and_adjust_index(npy_intp *index, npy_intp max_item, int axis, PyThreadState * _save) { @@ -137,7 +137,7 @@ check_and_adjust_index(npy_intp *index, npy_intp max_item, int axis, * * msg_prefix: borrowed reference, a string to prepend to the message */ -static NPY_INLINE int +static inline int check_and_adjust_axis_msg(int *axis, int ndim, PyObject *msg_prefix) { /* Check that index is valid, taking into account negative indices */ @@ -171,7 +171,7 @@ check_and_adjust_axis_msg(int *axis, int ndim, PyObject *msg_prefix) } return 0; } -static NPY_INLINE int +static inline int check_and_adjust_axis(int *axis, int ndim) { return check_and_adjust_axis_msg(axis, ndim, Py_None); @@ -191,7 +191,7 @@ check_and_adjust_axis(int *axis, int ndim) /* * return true if pointer is aligned to 'alignment' */ -static NPY_INLINE int +static inline int npy_is_aligned(const void * p, const npy_uintp alignment) { /* @@ -205,7 +205,7 @@ npy_is_aligned(const void * p, const npy_uintp alignment) } /* Get equivalent "uint" alignment given an itemsize, for use in copy code */ -static NPY_INLINE npy_uintp +static inline npy_uintp npy_uint_alignment(int itemsize) { npy_uintp alignment = 0; /* return value of 0 means unaligned */ @@ -252,7 +252,7 @@ npy_uint_alignment(int itemsize) */ __attribute__((no_sanitize("alignment"))) #endif -static NPY_INLINE char * +static inline char * npy_memchr(char * haystack, char needle, npy_intp stride, npy_intp size, npy_intp * psubloopsize, int invert) { @@ -302,7 +302,7 @@ npy_memchr(char * haystack, char needle, * flag means that NULL entries are replaced with None, which is occasionally * useful. */ -static NPY_INLINE PyObject * +static inline PyObject * PyArray_TupleFromItems(int n, PyObject *const *items, int make_null_none) { PyObject *tuple = PyTuple_New(n); diff --git a/numpy/core/src/multiarray/compiled_base.c b/numpy/core/src/multiarray/compiled_base.c index 82bed207b..2ae36c13a 100644 --- a/numpy/core/src/multiarray/compiled_base.c +++ b/numpy/core/src/multiarray/compiled_base.c @@ -378,7 +378,7 @@ arr_insert(PyObject *NPY_UNUSED(self), PyObject *args, PyObject *kwdict) #ifdef __INTEL_COMPILER #pragma intel optimization_level 0 #endif -static NPY_INLINE npy_intp +static inline npy_intp _linear_search(const npy_double key, const npy_double *arr, const npy_intp len, const npy_intp i0) { npy_intp i; @@ -1491,7 +1491,7 @@ arr_add_docstring(PyObject *NPY_UNUSED(dummy), PyObject *args) * byte array. Truth values are determined as usual: 0 is false, everything * else is true. */ -static NPY_GCC_OPT_3 NPY_INLINE void +static NPY_GCC_OPT_3 inline void pack_inner(const char *inptr, npy_intp element_size, /* in bytes */ npy_intp n_in, diff --git a/numpy/core/src/multiarray/conversion_utils.c b/numpy/core/src/multiarray/conversion_utils.c index 96afb6c00..84bf08206 100644 --- a/numpy/core/src/multiarray/conversion_utils.c +++ b/numpy/core/src/multiarray/conversion_utils.c @@ -84,7 +84,7 @@ PyArray_OutputConverter(PyObject *object, PyArrayObject **address) * to `PyArray_PyIntAsIntp`. Exists mainly to retain old behaviour of * `PyArray_IntpConverter` and `PyArray_IntpFromSequence` */ -static NPY_INLINE npy_intp +static inline npy_intp dimension_from_scalar(PyObject *ob) { npy_intp value = PyArray_PyIntAsIntp(ob); diff --git a/numpy/core/src/multiarray/conversion_utils.h b/numpy/core/src/multiarray/conversion_utils.h index 4d0fbb894..62f54749e 100644 --- a/numpy/core/src/multiarray/conversion_utils.h +++ b/numpy/core/src/multiarray/conversion_utils.h @@ -52,7 +52,7 @@ NPY_NO_EXPORT int PyArray_TypestrConvert(int itemsize, int gentype); -static NPY_INLINE PyObject * +static inline PyObject * PyArray_PyIntFromIntp(npy_intp const value) { #if NPY_SIZEOF_INTP <= NPY_SIZEOF_LONG diff --git a/numpy/core/src/multiarray/dtype_transfer.c b/numpy/core/src/multiarray/dtype_transfer.c index c07670488..549300f73 100644 --- a/numpy/core/src/multiarray/dtype_transfer.c +++ b/numpy/core/src/multiarray/dtype_transfer.c @@ -3010,7 +3010,7 @@ _strided_to_strided_multistep_cast( * Initialize most of a cast-info structure, this step does not fetch the * transferfunction and transferdata. */ -static NPY_INLINE int +static inline int init_cast_info( NPY_cast_info *cast_info, NPY_CASTING *casting, npy_intp *view_offset, PyArray_Descr *src_dtype, PyArray_Descr *dst_dtype, int main_step) diff --git a/numpy/core/src/multiarray/dtype_transfer.h b/numpy/core/src/multiarray/dtype_transfer.h index 9ae332e38..6f7aa2837 100644 --- a/numpy/core/src/multiarray/dtype_transfer.h +++ b/numpy/core/src/multiarray/dtype_transfer.h @@ -31,7 +31,7 @@ typedef struct { * copied. * If set up otherwise, func must be NULL'ed to indicate no-cleanup necessary. */ -static NPY_INLINE void +static inline void NPY_cast_info_init(NPY_cast_info *cast_info) { cast_info->func = NULL; /* mark as uninitialized. */ @@ -52,7 +52,7 @@ NPY_cast_info_init(NPY_cast_info *cast_info) * First checks whether `cast_info.func == NULL`, and assume it is * uninitialized in that case. */ -static NPY_INLINE void +static inline void NPY_cast_info_xfree(NPY_cast_info *cast_info) { if (cast_info->func == NULL) { @@ -71,7 +71,7 @@ NPY_cast_info_xfree(NPY_cast_info *cast_info) * Move the data from `original` to `cast_info`. Original is cleared * (its func set to NULL). */ -static NPY_INLINE void +static inline void NPY_cast_info_move(NPY_cast_info *cast_info, NPY_cast_info *original) { *cast_info = *original; @@ -87,7 +87,7 @@ NPY_cast_info_move(NPY_cast_info *cast_info, NPY_cast_info *original) * NOTE: It is acceptable to call this with the same struct if the struct * has been filled by a valid memcpy from an initialized one. */ -static NPY_INLINE int +static inline int NPY_cast_info_copy(NPY_cast_info *cast_info, NPY_cast_info *original) { cast_info->context.descriptors = cast_info->descriptors; diff --git a/numpy/core/src/multiarray/dtypemeta.c b/numpy/core/src/multiarray/dtypemeta.c index b52267291..6c33da729 100644 --- a/numpy/core/src/multiarray/dtypemeta.c +++ b/numpy/core/src/multiarray/dtypemeta.c @@ -73,7 +73,7 @@ dtypemeta_init(PyTypeObject *NPY_UNUSED(type), * @param self * @return nonzero if the object is garbage collected */ -static NPY_INLINE int +static inline int dtypemeta_is_gc(PyObject *dtype_class) { return PyType_Type.tp_is_gc(dtype_class); diff --git a/numpy/core/src/multiarray/dtypemeta.h b/numpy/core/src/multiarray/dtypemeta.h index 15318f040..5df333584 100644 --- a/numpy/core/src/multiarray/dtypemeta.h +++ b/numpy/core/src/multiarray/dtypemeta.h @@ -111,7 +111,7 @@ typedef struct { * (Error checking is not required for DescrFromType, assuming that the * type is valid.) */ -static NPY_INLINE PyArray_DTypeMeta * +static inline PyArray_DTypeMeta * PyArray_DTypeFromTypeNum(int typenum) { PyArray_Descr *descr = PyArray_DescrFromType(typenum); diff --git a/numpy/core/src/multiarray/item_selection.c b/numpy/core/src/multiarray/item_selection.c index 9fad153a3..e5331b2b4 100644 --- a/numpy/core/src/multiarray/item_selection.c +++ b/numpy/core/src/multiarray/item_selection.c @@ -30,7 +30,7 @@ #include "array_coercion.h" #include "simd/simd.h" -static NPY_GCC_OPT_3 NPY_INLINE int +static NPY_GCC_OPT_3 inline int npy_fasttake_impl( char *dest, char *src, const npy_intp *indices, npy_intp n, npy_intp m, npy_intp max_item, @@ -492,7 +492,7 @@ PyArray_PutTo(PyArrayObject *self, PyObject* values0, PyObject *indices0, } -static NPY_GCC_OPT_3 NPY_INLINE void +static NPY_GCC_OPT_3 inline void npy_fastputmask_impl( char *dest, char *src, const npy_bool *mask_data, npy_intp ni, npy_intp nv, npy_intp chunk) @@ -2113,7 +2113,7 @@ PyArray_Compress(PyArrayObject *self, PyObject *condition, int axis, * even though it uses 64 bit types its faster than the bytewise sum on 32 bit * but a 32 bit type version would make it even faster on these platforms */ -static NPY_INLINE npy_intp +static inline npy_intp count_nonzero_bytes_384(const npy_uint64 * w) { const npy_uint64 w1 = w[0]; @@ -2209,7 +2209,7 @@ count_zero_bytes_u16(const npy_uint8 **d, const npy_uint8 *end, npy_uint16 max_c * !! * (2*16-1)*16 */ -static NPY_INLINE NPY_GCC_OPT_3 npy_intp +static inline NPY_GCC_OPT_3 npy_intp count_nonzero_u8(const char *data, npy_intp bstride, npy_uintp len) { npy_intp count = 0; @@ -2245,7 +2245,7 @@ count_nonzero_u8(const char *data, npy_intp bstride, npy_uintp len) return count; } -static NPY_INLINE NPY_GCC_OPT_3 npy_intp +static inline NPY_GCC_OPT_3 npy_intp count_nonzero_u16(const char *data, npy_intp bstride, npy_uintp len) { npy_intp count = 0; @@ -2277,7 +2277,7 @@ count_nonzero_u16(const char *data, npy_intp bstride, npy_uintp len) return count; } -static NPY_INLINE NPY_GCC_OPT_3 npy_intp +static inline NPY_GCC_OPT_3 npy_intp count_nonzero_u32(const char *data, npy_intp bstride, npy_uintp len) { npy_intp count = 0; @@ -2307,7 +2307,7 @@ count_nonzero_u32(const char *data, npy_intp bstride, npy_uintp len) return count; } -static NPY_INLINE NPY_GCC_OPT_3 npy_intp +static inline NPY_GCC_OPT_3 npy_intp count_nonzero_u64(const char *data, npy_intp bstride, npy_uintp len) { npy_intp count = 0; diff --git a/numpy/core/src/multiarray/iterators.c b/numpy/core/src/multiarray/iterators.c index 95aa11d2d..4e6418bf9 100644 --- a/numpy/core/src/multiarray/iterators.c +++ b/numpy/core/src/multiarray/iterators.c @@ -1241,7 +1241,7 @@ PyArray_Broadcast(PyArrayMultiIterObject *mit) return 0; } -static NPY_INLINE PyObject* +static inline PyObject* multiiter_wrong_number_of_args(void) { return PyErr_Format(PyExc_ValueError, @@ -1615,7 +1615,7 @@ get_ptr_constant(PyArrayIterObject* _iter, const npy_intp *coordinates) * value 2 3 3 2 1 1 2 3 3 2 1 1 * * _npy_pos_index_mirror(4, 3) will return 1, because x[4] = x[1]*/ -NPY_INLINE static npy_intp +static inline npy_intp __npy_pos_remainder(npy_intp i, npy_intp n) { npy_intp k, l, j; @@ -1661,7 +1661,7 @@ get_ptr_mirror(PyArrayIterObject* _iter, const npy_intp *coordinates) #undef _INF_SET_PTR_MIRROR /* compute l such as i = k * n + l, 0 <= l < |k| */ -NPY_INLINE static npy_intp +static inline npy_intp __npy_euclidean_division(npy_intp i, npy_intp n) { npy_intp l; diff --git a/numpy/core/src/multiarray/mapping.c b/numpy/core/src/multiarray/mapping.c index 98c2d7eda..3dd488220 100644 --- a/numpy/core/src/multiarray/mapping.c +++ b/numpy/core/src/multiarray/mapping.c @@ -160,7 +160,7 @@ PyArray_MapIterSwapAxes(PyArrayMapIterObject *mit, PyArrayObject **ret, int getm *ret = (PyArrayObject *)new; } -static NPY_INLINE void +static inline void multi_DECREF(PyObject **objects, npy_intp n) { npy_intp i; @@ -176,7 +176,7 @@ multi_DECREF(PyObject **objects, npy_intp n) * Useful if a tuple is being iterated over multiple times, or for a code path * that doesn't always want the overhead of allocating a tuple. */ -static NPY_INLINE npy_intp +static inline npy_intp unpack_tuple(PyTupleObject *index, PyObject **result, npy_intp result_n) { npy_intp n, i; @@ -194,7 +194,7 @@ unpack_tuple(PyTupleObject *index, PyObject **result, npy_intp result_n) } /* Unpack a single scalar index, taking a new reference to match unpack_tuple */ -static NPY_INLINE npy_intp +static inline npy_intp unpack_scalar(PyObject *index, PyObject **result, npy_intp NPY_UNUSED(result_n)) { Py_INCREF(index); diff --git a/numpy/core/src/multiarray/multiarraymodule.c b/numpy/core/src/multiarray/multiarraymodule.c index b2925f758..8c8cc3c44 100644 --- a/numpy/core/src/multiarray/multiarraymodule.c +++ b/numpy/core/src/multiarray/multiarraymodule.c @@ -1622,7 +1622,7 @@ _prepend_ones(PyArrayObject *arr, int nd, int ndmin, NPY_ORDER order) ((order) == NPY_CORDER && PyArray_IS_C_CONTIGUOUS(op)) || \ ((order) == NPY_FORTRANORDER && PyArray_IS_F_CONTIGUOUS(op))) -static NPY_INLINE PyObject * +static inline PyObject * _array_fromobject_generic( PyObject *op, PyArray_Descr *type, _PyArray_CopyMode copy, NPY_ORDER order, npy_bool subok, int ndmin) diff --git a/numpy/core/src/multiarray/nditer_constr.c b/numpy/core/src/multiarray/nditer_constr.c index 93d2bc961..b969c9f1d 100644 --- a/numpy/core/src/multiarray/nditer_constr.c +++ b/numpy/core/src/multiarray/nditer_constr.c @@ -58,7 +58,7 @@ npyiter_fill_axisdata(NpyIter *iter, npy_uint32 flags, npyiter_opitflags *op_itf char **op_dataptr, const npy_uint32 *op_flags, int **op_axes, npy_intp const *itershape); -static NPY_INLINE int +static inline int npyiter_get_op_axis(int axis, npy_bool *reduction_axis); static void npyiter_replace_axisdata( @@ -1445,7 +1445,7 @@ npyiter_check_reduce_ok_and_set_flags( * @param reduction_axis Output 1 if a reduction axis, otherwise 0. * @returns The normalized axis (without reduce axis flag). */ -static NPY_INLINE int +static inline int npyiter_get_op_axis(int axis, npy_bool *reduction_axis) { npy_bool forced_broadcast = axis >= NPY_ITER_REDUCTION_AXIS(-1); @@ -2249,7 +2249,7 @@ npyiter_reverse_axis_ordering(NpyIter *iter) NIT_ITFLAGS(iter) &= ~NPY_ITFLAG_IDENTPERM; } -static NPY_INLINE npy_intp +static inline npy_intp intp_abs(npy_intp x) { return (x < 0) ? -x : x; diff --git a/numpy/core/src/multiarray/nditer_impl.h b/numpy/core/src/multiarray/nditer_impl.h index 6650fc0a8..5bf47fabd 100644 --- a/numpy/core/src/multiarray/nditer_impl.h +++ b/numpy/core/src/multiarray/nditer_impl.h @@ -329,7 +329,7 @@ struct NpyIter_AxisData_tag { * @return The unpermuted axis. Without `op_axes` this is correct, with * `op_axes` this indexes into `op_axes` (unpermuted iterator axis) */ -static NPY_INLINE int +static inline int npyiter_undo_iter_axis_perm( int axis, int ndim, const npy_int8 *perm, npy_bool *axis_flipped) { diff --git a/numpy/core/src/multiarray/scalartypes.c.src b/numpy/core/src/multiarray/scalartypes.c.src index 32dc60e06..18e793775 100644 --- a/numpy/core/src/multiarray/scalartypes.c.src +++ b/numpy/core/src/multiarray/scalartypes.c.src @@ -447,7 +447,7 @@ unicodetype_@form@(PyObject *self) * * Largely copied from _Py_strhex_impl in CPython implementation */ -static NPY_INLINE PyObject * +static inline PyObject * _void_to_hex(const char* argbuf, const Py_ssize_t arglen, const char *schars, const char *bprefix, const char *echars) { @@ -3318,7 +3318,7 @@ long_arrtype_hash(PyObject *obj) * #Char = ,U# * #Word = ,Unsigned# */ -static NPY_INLINE npy_hash_t +static inline npy_hash_t @char@longlong_arrtype_hash(PyObject *obj) { PyObject * l = PyLong_From@Word@LongLong( diff --git a/numpy/core/src/multiarray/shape.c b/numpy/core/src/multiarray/shape.c index dc7151a9b..25af43bbc 100644 --- a/numpy/core/src/multiarray/shape.c +++ b/numpy/core/src/multiarray/shape.c @@ -787,7 +787,7 @@ PyArray_CreateSortedStridePerm(int ndim, npy_intp const *strides, &_npy_stride_sort_item_comparator); } -static NPY_INLINE npy_intp +static inline npy_intp s_intp_abs(npy_intp x) { return (x < 0) ? -x : x; diff --git a/numpy/core/src/multiarray/textreading/conversions.c b/numpy/core/src/multiarray/textreading/conversions.c index 6c93e02d8..67a4803b9 100644 --- a/numpy/core/src/multiarray/textreading/conversions.c +++ b/numpy/core/src/multiarray/textreading/conversions.c @@ -47,7 +47,7 @@ npy_to_bool(PyArray_Descr *NPY_UNUSED(descr), * (used by the complex parser). * @param result Output stored as double value. */ -static NPY_INLINE int +static inline int double_from_ucs4( const Py_UCS4 *str, const Py_UCS4 *end, bool strip_whitespace, double *result, const Py_UCS4 **p_end) diff --git a/numpy/core/src/multiarray/textreading/stream_pyobject.c b/numpy/core/src/multiarray/textreading/stream_pyobject.c index 6f84ff01d..374bbd5ba 100644 --- a/numpy/core/src/multiarray/textreading/stream_pyobject.c +++ b/numpy/core/src/multiarray/textreading/stream_pyobject.c @@ -41,7 +41,7 @@ typedef struct { * * NOTE: Steals a reference to `str` (although usually returns it unmodified). */ -static NPY_INLINE PyObject * +static inline PyObject * process_stringlike(PyObject *str, const char *encoding) { if (PyBytes_Check(str)) { @@ -63,7 +63,7 @@ process_stringlike(PyObject *str, const char *encoding) } -static NPY_INLINE void +static inline void buffer_info_from_unicode(PyObject *str, char **start, char **end, int *kind) { Py_ssize_t length = PyUnicode_GET_LENGTH(str); diff --git a/numpy/core/src/npymath/npy_math_complex.c.src b/numpy/core/src/npymath/npy_math_complex.c.src index 696495dab..e0c078444 100644 --- a/numpy/core/src/npymath/npy_math_complex.c.src +++ b/numpy/core/src/npymath/npy_math_complex.c.src @@ -72,7 +72,7 @@ static const @ctype@ c_1@c@ = {1.0@C@, 0.0}; * These are necessary because we do not count on using a * C99 compiler. *=========================================================*/ -static NPY_INLINE +static inline @ctype@ cmul@c@(@ctype@ a, @ctype@ b) { @@ -84,7 +84,7 @@ cmul@c@(@ctype@ a, @ctype@ b) return npy_cpack@c@(ar*br - ai*bi, ar*bi + ai*br); } -static NPY_INLINE +static inline @ctype@ cdiv@c@(@ctype@ a, @ctype@ b) { @@ -573,7 +573,7 @@ npy_cpow@c@ (@ctype@ a, @ctype@ b) * Function f(a, b, hypot_a_b) = (hypot(a, b) - b) / 2. * Pass hypot(a, b) as the third argument. */ -static NPY_INLINE @type@ +static inline @type@ _f@c@(@type@ a, @type@ b, @type@ hypot_a_b) { if (b < 0) { @@ -595,7 +595,7 @@ _f@c@(@type@ a, @type@ b, @type@ hypot_a_b) * If returning sqrt_A2my2 has potential to result in an underflow, it is * rescaled, and new_y is similarly rescaled. */ -static NPY_INLINE void +static inline void _do_hard_work@c@(@type@ x, @type@ y, @type@ *rx, npy_int *B_is_usable, @type@ *B, @type@ *sqrt_A2my2, @type@ *new_y) { @@ -739,7 +739,7 @@ _do_hard_work@c@(@type@ x, @type@ y, @type@ *rx, /* * Optimized version of clog() for |z| finite and larger than ~RECIP_EPSILON. */ -static NPY_INLINE void +static inline void _clog_for_large_values@c@(@type@ x, @type@ y, @type@ *rr, @type@ *ri) { @@ -1040,7 +1040,7 @@ npy_casinh@c@(@ctype@ z) * Assumes y is non-negative. * Assumes fabs(x) >= DBL_EPSILON. */ -static NPY_INLINE @type@ +static inline @type@ _sum_squares@c@(@type@ x, @type@ y) { #if @precision@ == 1 @@ -1077,7 +1077,7 @@ const npy_longdouble SQRT_MIN = 1.8336038675548471656e-2466l; #if @precision@ == 1 #define BIAS (FLT_MAX_EXP - 1) #define CUTOFF (FLT_MANT_DIG / 2 + 1) -static NPY_INLINE npy_float +static inline npy_float _real_part_reciprocalf(npy_float x, npy_float y) { npy_float scale; @@ -1110,7 +1110,7 @@ _real_part_reciprocalf(npy_float x, npy_float y) #define BIAS (DBL_MAX_EXP - 1) /* more guard digits are useful iff there is extra precision. */ #define CUTOFF (DBL_MANT_DIG / 2 + 1) /* just half or 1 guard digit */ -static NPY_INLINE npy_double +static inline npy_double _real_part_reciprocal(npy_double x, npy_double y) { npy_double scale; @@ -1152,7 +1152,7 @@ _real_part_reciprocal(npy_double x, npy_double y) #define BIAS (LDBL_MAX_EXP - 1) #define CUTOFF (LDBL_MANT_DIG / 2 + 1) -static NPY_INLINE npy_longdouble +static inline npy_longdouble _real_part_reciprocall(npy_longdouble x, npy_longdouble y) { @@ -1185,7 +1185,7 @@ _real_part_reciprocall(npy_longdouble x, #else -static NPY_INLINE npy_longdouble +static inline npy_longdouble _real_part_reciprocall(npy_longdouble x, npy_longdouble y) { diff --git a/numpy/core/src/npysort/npysort_common.h b/numpy/core/src/npysort/npysort_common.h index ab9f456b6..851eb89da 100644 --- a/numpy/core/src/npysort/npysort_common.h +++ b/numpy/core/src/npysort/npysort_common.h @@ -44,112 +44,112 @@ extern "C" { ***************************************************************************** */ -NPY_INLINE static int +static inline int BOOL_LT(npy_bool a, npy_bool b) { return a < b; } -NPY_INLINE static int +static inline int BYTE_LT(npy_byte a, npy_byte b) { return a < b; } -NPY_INLINE static int +static inline int UBYTE_LT(npy_ubyte a, npy_ubyte b) { return a < b; } -NPY_INLINE static int +static inline int SHORT_LT(npy_short a, npy_short b) { return a < b; } -NPY_INLINE static int +static inline int USHORT_LT(npy_ushort a, npy_ushort b) { return a < b; } -NPY_INLINE static int +static inline int INT_LT(npy_int a, npy_int b) { return a < b; } -NPY_INLINE static int +static inline int UINT_LT(npy_uint a, npy_uint b) { return a < b; } -NPY_INLINE static int +static inline int LONG_LT(npy_long a, npy_long b) { return a < b; } -NPY_INLINE static int +static inline int ULONG_LT(npy_ulong a, npy_ulong b) { return a < b; } -NPY_INLINE static int +static inline int LONGLONG_LT(npy_longlong a, npy_longlong b) { return a < b; } -NPY_INLINE static int +static inline int ULONGLONG_LT(npy_ulonglong a, npy_ulonglong b) { return a < b; } -NPY_INLINE static int +static inline int FLOAT_LT(npy_float a, npy_float b) { return a < b || (b != b && a == a); } -NPY_INLINE static int +static inline int DOUBLE_LT(npy_double a, npy_double b) { return a < b || (b != b && a == a); } -NPY_INLINE static int +static inline int LONGDOUBLE_LT(npy_longdouble a, npy_longdouble b) { return a < b || (b != b && a == a); } -NPY_INLINE static int +static inline int _npy_half_isnan(npy_half h) { return ((h&0x7c00u) == 0x7c00u) && ((h&0x03ffu) != 0x0000u); } -NPY_INLINE static int +static inline int _npy_half_lt_nonan(npy_half h1, npy_half h2) { if (h1&0x8000u) { @@ -172,7 +172,7 @@ _npy_half_lt_nonan(npy_half h1, npy_half h2) } -NPY_INLINE static int +static inline int HALF_LT(npy_half a, npy_half b) { int ret; @@ -192,7 +192,7 @@ HALF_LT(npy_half a, npy_half b) * of an if statement. It's a SUN compiler thing, so assign the return value * to a variable instead. */ -NPY_INLINE static int +static inline int CFLOAT_LT(npy_cfloat a, npy_cfloat b) { int ret; @@ -214,7 +214,7 @@ CFLOAT_LT(npy_cfloat a, npy_cfloat b) } -NPY_INLINE static int +static inline int CDOUBLE_LT(npy_cdouble a, npy_cdouble b) { int ret; @@ -236,7 +236,7 @@ CDOUBLE_LT(npy_cdouble a, npy_cdouble b) } -NPY_INLINE static int +static inline int CLONGDOUBLE_LT(npy_clongdouble a, npy_clongdouble b) { int ret; @@ -258,14 +258,14 @@ CLONGDOUBLE_LT(npy_clongdouble a, npy_clongdouble b) } -NPY_INLINE static void +static inline void STRING_COPY(char *s1, char const*s2, size_t len) { memcpy(s1, s2, len); } -NPY_INLINE static void +static inline void STRING_SWAP(char *s1, char *s2, size_t len) { while(len--) { @@ -276,7 +276,7 @@ STRING_SWAP(char *s1, char *s2, size_t len) } -NPY_INLINE static int +static inline int STRING_LT(const char *s1, const char *s2, size_t len) { const unsigned char *c1 = (const unsigned char *)s1; @@ -294,7 +294,7 @@ STRING_LT(const char *s1, const char *s2, size_t len) } -NPY_INLINE static void +static inline void UNICODE_COPY(npy_ucs4 *s1, npy_ucs4 const *s2, size_t len) { while(len--) { @@ -303,7 +303,7 @@ UNICODE_COPY(npy_ucs4 *s1, npy_ucs4 const *s2, size_t len) } -NPY_INLINE static void +static inline void UNICODE_SWAP(npy_ucs4 *s1, npy_ucs4 *s2, size_t len) { while(len--) { @@ -314,7 +314,7 @@ UNICODE_SWAP(npy_ucs4 *s1, npy_ucs4 *s2, size_t len) } -NPY_INLINE static int +static inline int UNICODE_LT(const npy_ucs4 *s1, const npy_ucs4 *s2, size_t len) { size_t i; @@ -330,7 +330,7 @@ UNICODE_LT(const npy_ucs4 *s1, const npy_ucs4 *s2, size_t len) } -NPY_INLINE static int +static inline int DATETIME_LT(npy_datetime a, npy_datetime b) { if (a == NPY_DATETIME_NAT) { @@ -345,7 +345,7 @@ DATETIME_LT(npy_datetime a, npy_datetime b) } -NPY_INLINE static int +static inline int TIMEDELTA_LT(npy_timedelta a, npy_timedelta b) { if (a == NPY_DATETIME_NAT) { @@ -360,14 +360,14 @@ TIMEDELTA_LT(npy_timedelta a, npy_timedelta b) } -NPY_INLINE static void +static inline void GENERIC_COPY(char *a, char *b, size_t len) { memcpy(a, b, len); } -NPY_INLINE static void +static inline void GENERIC_SWAP(char *a, char *b, size_t len) { while(len--) { diff --git a/numpy/core/src/npysort/npysort_heapsort.h b/numpy/core/src/npysort/npysort_heapsort.h index 762d89b7b..442320094 100644 --- a/numpy/core/src/npysort/npysort_heapsort.h +++ b/numpy/core/src/npysort/npysort_heapsort.h @@ -16,7 +16,7 @@ */ template <typename Tag, typename type> -NPY_INLINE NPY_NO_EXPORT +inline NPY_NO_EXPORT int heapsort_(type *start, npy_intp n) { type tmp, *a; @@ -67,7 +67,7 @@ int heapsort_(type *start, npy_intp n) } template <typename Tag, typename type> -NPY_INLINE NPY_NO_EXPORT +inline NPY_NO_EXPORT int aheapsort_(type *vv, npy_intp *tosort, npy_intp n) { type *v = vv; @@ -123,7 +123,7 @@ int aheapsort_(type *vv, npy_intp *tosort, npy_intp n) */ template <typename Tag, typename type> -NPY_INLINE NPY_NO_EXPORT +inline NPY_NO_EXPORT int string_heapsort_(type *start, npy_intp n, void *varr) { PyArrayObject *arr = (PyArrayObject *)varr; @@ -177,7 +177,7 @@ int string_heapsort_(type *start, npy_intp n, void *varr) } template <typename Tag, typename type> -NPY_INLINE NPY_NO_EXPORT +inline NPY_NO_EXPORT int string_aheapsort_(type *vv, npy_intp *tosort, npy_intp n, void *varr) { type *v = vv; diff --git a/numpy/core/src/umath/dispatching.c b/numpy/core/src/umath/dispatching.c index 077d56f33..2de5a5670 100644 --- a/numpy/core/src/umath/dispatching.c +++ b/numpy/core/src/umath/dispatching.c @@ -58,7 +58,7 @@ /* forward declaration */ -static NPY_INLINE PyObject * +static inline PyObject * promote_and_get_info_and_ufuncimpl(PyUFuncObject *ufunc, PyArrayObject *const ops[], PyArray_DTypeMeta *signature[], @@ -725,7 +725,7 @@ add_and_return_legacy_wrapping_ufunc_loop(PyUFuncObject *ufunc, * If value-based promotion is necessary, this is handled ahead of time by * `promote_and_get_ufuncimpl`. */ -static NPY_INLINE PyObject * +static inline PyObject * promote_and_get_info_and_ufuncimpl(PyUFuncObject *ufunc, PyArrayObject *const ops[], PyArray_DTypeMeta *signature[], diff --git a/numpy/core/src/umath/fast_loop_macros.h b/numpy/core/src/umath/fast_loop_macros.h index cbd1f04aa..5274957f7 100644 --- a/numpy/core/src/umath/fast_loop_macros.h +++ b/numpy/core/src/umath/fast_loop_macros.h @@ -27,7 +27,7 @@ */ #define MAX_STEP_SIZE 2097152 -static NPY_INLINE npy_uintp +static inline npy_uintp abs_ptrdiff(char *a, char *b) { return (a > b) ? (a - b) : (b - a); diff --git a/numpy/core/src/umath/loops_arithm_fp.dispatch.c.src b/numpy/core/src/umath/loops_arithm_fp.dispatch.c.src index bf8142880..f637ecfe4 100644 --- a/numpy/core/src/umath/loops_arithm_fp.dispatch.c.src +++ b/numpy/core/src/umath/loops_arithm_fp.dispatch.c.src @@ -451,7 +451,7 @@ simd_binary_scalar2_@kind@_@TYPE@(@type@ * op, @type@ * ip1, @type@ * ip2, npy_i * Arithmetic * # kind = add, subtract, multiply, divide# */ -static NPY_INLINE int +static inline int run_binary_simd_@kind@_@TYPE@(char **args, npy_intp const *dimensions, npy_intp const *steps) { #if @vector@ && defined NPY_HAVE_SSE2 @@ -659,7 +659,7 @@ avx512_cmul_@vsub@(@vtype@ x1, @vtype@ x2) * #vectorf = _mm512_add, _mm512_sub, avx512_cmul# */ #if defined AVX512F_NOMSVC -static NPY_INLINE void +static inline void AVX512F_@func@_@TYPE@(char **args, const npy_intp *dimensions, const npy_intp *steps) { const npy_intp array_size = dimensions[0]; @@ -701,7 +701,7 @@ AVX512F_@func@_@TYPE@(char **args, const npy_intp *dimensions, const npy_intp *s /**begin repeat1 * #func = add, subtract, multiply# */ -static NPY_INLINE int +static inline int run_binary_avx512f_@func@_@TYPE@(char **args, const npy_intp *dimensions, const npy_intp *steps) { #if defined AVX512F_NOMSVC diff --git a/numpy/core/src/umath/loops_arithmetic.dispatch.c.src b/numpy/core/src/umath/loops_arithmetic.dispatch.c.src index 5b5f13ad1..ea8685002 100644 --- a/numpy/core/src/umath/loops_arithmetic.dispatch.c.src +++ b/numpy/core/src/umath/loops_arithmetic.dispatch.c.src @@ -42,7 +42,7 @@ * #sfx = s8, s16, s32, s64# * #len = 8, 16, 32, 64# */ -static NPY_INLINE void +static inline void simd_divide_by_scalar_contig_@sfx@(char **args, npy_intp len) { npyv_lanetype_@sfx@ *src = (npyv_lanetype_@sfx@ *) args[0]; @@ -108,7 +108,7 @@ simd_divide_by_scalar_contig_@sfx@(char **args, npy_intp len) * #sfx = u8, u16, u32, u64# * #len = 8, 16, 32, 64# */ -static NPY_INLINE void +static inline void simd_divide_by_scalar_contig_@sfx@(char **args, npy_intp len) { npyv_lanetype_@sfx@ *src = (npyv_lanetype_@sfx@ *) args[0]; @@ -207,7 +207,7 @@ vsx4_div_@t@16(npyv_@t@16 a, npyv_@t@16 b) * #sfx = u8, u16, u32, u64# * #len = 8, 16, 32, 64# */ -static NPY_INLINE void +static inline void vsx4_simd_divide_contig_@sfx@(char **args, npy_intp len) { npyv_lanetype_@sfx@ *src1 = (npyv_lanetype_@sfx@ *) args[0]; @@ -246,7 +246,7 @@ vsx4_simd_divide_contig_@sfx@(char **args, npy_intp len) * #sfx = s8, s16, s32, s64# * #len = 8, 16, 32, 64# */ -static NPY_INLINE void +static inline void vsx4_simd_divide_contig_@sfx@(char **args, npy_intp len) { npyv_lanetype_@sfx@ *src1 = (npyv_lanetype_@sfx@ *) args[0]; diff --git a/numpy/core/src/umath/loops_comparison.dispatch.c.src b/numpy/core/src/umath/loops_comparison.dispatch.c.src index 2f75593a5..2cd76c35e 100644 --- a/numpy/core/src/umath/loops_comparison.dispatch.c.src +++ b/numpy/core/src/umath/loops_comparison.dispatch.c.src @@ -308,7 +308,7 @@ static void simd_binary_scalar2_@kind@_b8(char **args, npy_intp len) * #OP = ==, !=, <, <=# */ #if !((@eq@ || @neq@) && @signed@) -static NPY_INLINE void +static inline void run_binary_simd_@kind@_@sfx@(char **args, npy_intp const *dimensions, npy_intp const *steps) { #if @VECTOR@ diff --git a/numpy/core/src/umath/loops_exponent_log.dispatch.c.src b/numpy/core/src/umath/loops_exponent_log.dispatch.c.src index 8f123a48b..182c57b01 100644 --- a/numpy/core/src/umath/loops_exponent_log.dispatch.c.src +++ b/numpy/core/src/umath/loops_exponent_log.dispatch.c.src @@ -1146,7 +1146,7 @@ AVX512F_log_DOUBLE(npy_double * op, * #vtype2_scatter = _mm512_mask_i32scatter_epi32, _mm256_mask_i32scatter_epi32# * #setzero = _mm512_setzero_epi32, _mm256_setzero_si256# */ -static NPY_INLINE void +static inline void AVX512_SKX_ldexp_@TYPE@(char **args, npy_intp const *dimensions, npy_intp const *steps) { const npy_intp stride_ip1 = steps[0]/(npy_intp)sizeof(@type@); @@ -1215,7 +1215,7 @@ AVX512_SKX_ldexp_@TYPE@(char **args, npy_intp const *dimensions, npy_intp const } } -static NPY_INLINE void +static inline void AVX512_SKX_frexp_@TYPE@(char **args, npy_intp const *dimensions, npy_intp const *steps) { const npy_intp stride_ip1 = steps[0]/(npy_intp)sizeof(@type@); diff --git a/numpy/core/src/umath/loops_modulo.dispatch.c.src b/numpy/core/src/umath/loops_modulo.dispatch.c.src index 53b7da289..25edffb1e 100644 --- a/numpy/core/src/umath/loops_modulo.dispatch.c.src +++ b/numpy/core/src/umath/loops_modulo.dispatch.c.src @@ -171,7 +171,7 @@ vsx4_divisor_@sfx@(const npyv_@sfx@ vscalar) * #func = fmod, remainder, divmod# * #id = 0, 1, 2# */ -static NPY_INLINE void +static inline void vsx4_simd_@func@_contig_@sfx@(char **args, npy_intp len) { npyv_lanetype_@sfx@ *src1 = (npyv_lanetype_@sfx@ *) args[0]; @@ -239,7 +239,7 @@ vsx4_simd_@func@_contig_@sfx@(char **args, npy_intp len) npyv_cleanup(); } -static NPY_INLINE void +static inline void vsx4_simd_@func@_by_scalar_contig_@sfx@(char **args, npy_intp len) { npyv_lanetype_@sfx@ *src1 = (npyv_lanetype_@sfx@ *) args[0]; @@ -292,7 +292,7 @@ vsx4_simd_@func@_by_scalar_contig_@sfx@(char **args, npy_intp len) * #func = fmod, remainder, divmod# * #id = 0, 1, 2# */ -static NPY_INLINE void +static inline void vsx4_simd_@func@_contig_@sfx@(char **args, npy_intp len) { npyv_lanetype_@sfx@ *src1 = (npyv_lanetype_@sfx@ *) args[0]; @@ -410,7 +410,7 @@ vsx4_simd_@func@_contig_@sfx@(char **args, npy_intp len) npyv_cleanup(); } -static NPY_INLINE void +static inline void vsx4_simd_@func@_by_scalar_contig_@sfx@(char **args, npy_intp len) { npyv_lanetype_@sfx@ *src1 = (npyv_lanetype_@sfx@ *) args[0]; diff --git a/numpy/core/src/umath/loops_utils.h.src b/numpy/core/src/umath/loops_utils.h.src index df92bc315..5640a1f0b 100644 --- a/numpy/core/src/umath/loops_utils.h.src +++ b/numpy/core/src/umath/loops_utils.h.src @@ -74,7 +74,7 @@ is_mem_overlap(const void *src, npy_intp src_step, const void *dst, npy_intp dst * The recursion depth is O(lg n) as well. * when updating also update similar complex floats summation */ -static NPY_INLINE @type@ +static inline @type@ @TYPE@_pairwise_sum(char *a, npy_intp n, npy_intp stride) { if (n < 8) { @@ -152,7 +152,7 @@ static NPY_INLINE @type@ * #SIMD = 1, 1, 0# */ /* similar to pairwise sum of real floats */ -static NPY_INLINE void +static inline void @TYPE@_pairwise_sum(@ftype@ *rr, @ftype@ * ri, char * a, npy_intp n, npy_intp stride) { diff --git a/numpy/core/src/umath/matmul.c.src b/numpy/core/src/umath/matmul.c.src index 4dd0c4759..127bb5e27 100644 --- a/numpy/core/src/umath/matmul.c.src +++ b/numpy/core/src/umath/matmul.c.src @@ -45,7 +45,7 @@ * 3. The slower (first) axis stride, in unit steps, must be larger than * the faster axis dimension */ -static NPY_INLINE npy_bool +static inline npy_bool is_blasable2d(npy_intp byte_stride1, npy_intp byte_stride2, npy_intp d1, npy_intp d2, npy_intp itemsize) { diff --git a/numpy/core/src/umath/scalarmath.c.src b/numpy/core/src/umath/scalarmath.c.src index 7c63ac0f1..9d703504f 100644 --- a/numpy/core/src/umath/scalarmath.c.src +++ b/numpy/core/src/umath/scalarmath.c.src @@ -57,7 +57,7 @@ * #name = byte, short, int, long, longlong# * #type = npy_byte, npy_short, npy_int, npy_long, npy_longlong# */ -static NPY_INLINE int +static inline int @name@_ctype_add(@type@ a, @type@ b, @type@ *out) { *out = a + b; if ((*out^a) >= 0 || (*out^b) >= 0) { @@ -66,7 +66,7 @@ static NPY_INLINE int return NPY_FPE_OVERFLOW; } -static NPY_INLINE int +static inline int @name@_ctype_subtract(@type@ a, @type@ b, @type@ *out) { *out = a - b; if ((*out^a) >= 0 || (*out^~b) >= 0) { @@ -80,7 +80,7 @@ static NPY_INLINE int * #name = ubyte, ushort, uint, ulong, ulonglong# * #type = npy_ubyte, npy_ushort, npy_uint, npy_ulong, npy_ulonglong# */ -static NPY_INLINE int +static inline int @name@_ctype_add(@type@ a, @type@ b, @type@ *out) { *out = a + b; if (*out >= a && *out >= b) { @@ -89,7 +89,7 @@ static NPY_INLINE int return NPY_FPE_OVERFLOW; } -static NPY_INLINE int +static inline int @name@_ctype_subtract(@type@ a, @type@ b, @type@ *out) { *out = a - b; if (a >= b) { @@ -118,7 +118,7 @@ static NPY_INLINE int * #neg = (1,0)*4# */ #if NPY_SIZEOF_@SIZE@ > NPY_SIZEOF_@SIZENAME@ -static NPY_INLINE int +static inline int @name@_ctype_multiply(@type@ a, @type@ b, @type@ *out) { @big@ temp; temp = ((@big@) a) * ((@big@) b); @@ -144,7 +144,7 @@ static NPY_INLINE int * #SIZE = INT*2, LONG*2, LONGLONG*2# */ #if NPY_SIZEOF_LONGLONG == NPY_SIZEOF_@SIZE@ -static NPY_INLINE int +static inline int @name@_ctype_multiply(@type@ a, @type@ b, @type@ *out) { if (npy_mul_with_overflow_@name@(out, a, b)) { return NPY_FPE_OVERFLOW; @@ -171,7 +171,7 @@ static NPY_INLINE int #define DIVIDEBYZERO_CHECK (b == 0) #endif -static NPY_INLINE int +static inline int @name@_ctype_divide(@type@ a, @type@ b, @type@ *out) { if (b == 0) { *out = 0; @@ -200,7 +200,7 @@ static NPY_INLINE int #define @name@_ctype_floor_divide @name@_ctype_divide -static NPY_INLINE int +static inline int @name@_ctype_remainder(@type@ a, @type@ b, @type@ *out) { if (DIVIDEBYZERO_CHECK) { *out = 0; @@ -232,7 +232,7 @@ static NPY_INLINE int * ulong, longlong, ulonglong# */ -static NPY_INLINE int +static inline int @name@_ctype_true_divide(npy_@name@ a, npy_@name@ b, npy_double *out) { *out = (npy_double)a / (npy_double)b; @@ -251,7 +251,7 @@ static NPY_INLINE int * #upc = BYTE, UBYTE, SHORT, USHORT, INT, UINT, * LONG, ULONG, LONGLONG, ULONGLONG# */ -static NPY_INLINE int +static inline int @name@_ctype_power(@type@ a, @type@ b, @type@ *out) { @type@ tmp; @@ -292,7 +292,7 @@ static NPY_INLINE int * #op = &, ^, |# */ -static NPY_INLINE int +static inline int @name@_ctype_@oper@(@type@ arg1, @type@ arg2, @type@ *out) { *out = arg1 @op@ arg2; @@ -301,14 +301,14 @@ static NPY_INLINE int /**end repeat1**/ -static NPY_INLINE int +static inline int @name@_ctype_lshift(@type@ arg1, @type@ arg2, @type@ *out) { *out = npy_lshift@suffix@(arg1, arg2); return 0; } -static NPY_INLINE int +static inline int @name@_ctype_rshift(@type@ arg1, @type@ arg2, @type@ *out) { *out = npy_rshift@suffix@(arg1, arg2); @@ -328,7 +328,7 @@ static NPY_INLINE int * #oper = add, subtract, multiply, divide# */ -static NPY_INLINE int +static inline int @name@_ctype_@oper@(@type@ a, @type@ b, @type@ *out) { *out = a @OP@ b; @@ -340,21 +340,21 @@ static NPY_INLINE int #define @name@_ctype_true_divide @name@_ctype_divide -static NPY_INLINE int +static inline int @name@_ctype_floor_divide(@type@ a, @type@ b, @type@ *out) { *out = npy_floor_divide@c@(a, b); return 0; } -static NPY_INLINE int +static inline int @name@_ctype_remainder(@type@ a, @type@ b, @type@ *out) { *out = npy_remainder@c@(a, b); return 0; } -static NPY_INLINE int +static inline int @name@_ctype_divmod(@type@ a, @type@ b, @type@ *out1, @type@ *out2) { *out1 = npy_divmod@c@(a, b, out2); return 0; @@ -368,7 +368,7 @@ static NPY_INLINE int * #oper = add, subtract, multiply, divide# */ -static NPY_INLINE int +static inline int half_ctype_@oper@(npy_half a, npy_half b, npy_half *out) { float res = npy_half_to_float(a) @OP@ npy_half_to_float(b); @@ -380,7 +380,7 @@ half_ctype_@oper@(npy_half a, npy_half b, npy_half *out) #define half_ctype_true_divide half_ctype_divide -static NPY_INLINE int +static inline int half_ctype_floor_divide(npy_half a, npy_half b, npy_half *out) { npy_half mod; @@ -396,7 +396,7 @@ half_ctype_floor_divide(npy_half a, npy_half b, npy_half *out) } -static NPY_INLINE int +static inline int half_ctype_remainder(npy_half a, npy_half b, npy_half *out) { npy_half_divmod(a, b, out); @@ -404,7 +404,7 @@ half_ctype_remainder(npy_half a, npy_half b, npy_half *out) } -static NPY_INLINE int +static inline int half_ctype_divmod(npy_half a, npy_half b, npy_half *out1, npy_half *out2) { *out1 = npy_half_divmod(a, b, out2); @@ -419,7 +419,7 @@ half_ctype_divmod(npy_half a, npy_half b, npy_half *out1, npy_half *out2) * #rtype = npy_float, npy_double, npy_longdouble# * #c = f,,l# */ -static NPY_INLINE int +static inline int @name@_ctype_add(@type@ a, @type@ b, @type@ *out) { out->real = a.real + b.real; @@ -427,7 +427,7 @@ static NPY_INLINE int return 0; } -static NPY_INLINE int +static inline int @name@_ctype_subtract(@type@ a, @type@ b, @type@ *out) { out->real = a.real - b.real; @@ -440,7 +440,7 @@ static NPY_INLINE int * TODO: Mark as to work around FPEs not being issues on clang 12. * This should be removed when possible. */ -static NPY_INLINE int +static inline int @name@_ctype_multiply( @type@ a, @type@ b, @type@ *out) { out->real = a.real * b.real - a.imag * b.imag; @@ -449,7 +449,7 @@ static NPY_INLINE int } /* Use the ufunc loop directly to avoid duplicating the complicated logic */ -static NPY_INLINE int +static inline int @name@_ctype_divide(@type@ a, @type@ b, @type@ *out) { char *args[3] = {(char *)&a, (char *)&b, (char *)out}; @@ -470,7 +470,7 @@ static NPY_INLINE int * longlong, ulonglong# */ -static NPY_INLINE int +static inline int @name@_ctype_divmod(npy_@name@ a, npy_@name@ b, npy_@name@ *out, npy_@name@ *out2) { int res = @name@_ctype_floor_divide(a, b, out); @@ -487,7 +487,7 @@ static NPY_INLINE int * #c = f,,l# */ -static NPY_INLINE int +static inline int @name@_ctype_power(@type@ a, @type@ b, @type@ *out) { *out = npy_pow@c@(a, b); @@ -495,7 +495,7 @@ static NPY_INLINE int } /**end repeat**/ -static NPY_INLINE int +static inline int half_ctype_power(npy_half a, npy_half b, npy_half *out) { const npy_float af = npy_half_to_float(a); @@ -518,7 +518,7 @@ half_ctype_power(npy_half a, npy_half b, npy_half *out) * #uns = (0,1)*5,0*3# * #int = 1*10,0*3# */ -static NPY_INLINE int +static inline int @name@_ctype_negative(@type@ a, @type@ *out) { #if @uns@ @@ -541,7 +541,7 @@ static NPY_INLINE int } /**end repeat**/ -static NPY_INLINE int +static inline int half_ctype_negative(npy_half a, npy_half *out) { *out = a^0x8000u; @@ -553,7 +553,7 @@ half_ctype_negative(npy_half a, npy_half *out) * #name = cfloat, cdouble, clongdouble# * #type = npy_cfloat, npy_cdouble, npy_clongdouble# */ -static NPY_INLINE int +static inline int @name@_ctype_negative(@type@ a, @type@ *out) { out->real = -a.real; @@ -570,7 +570,7 @@ static NPY_INLINE int * npy_long, npy_ulong, npy_longlong, npy_ulonglong, * npy_half, npy_float, npy_double, npy_longdouble# */ -static NPY_INLINE int +static inline int @name@_ctype_positive(@type@ a, @type@ *out) { *out = a; @@ -583,7 +583,7 @@ static NPY_INLINE int * #type = npy_cfloat, npy_cdouble, npy_clongdouble# * #c = f,,l# */ -static NPY_INLINE int +static inline int @name@_ctype_positive(@type@ a, @type@ *out) { out->real = a.real; @@ -591,7 +591,7 @@ static NPY_INLINE int return 0; } -static NPY_INLINE int +static inline int @name@_ctype_power(@type@ a, @type@ b, @type@ *out) { *out = npy_cpow@c@(a, b); @@ -614,7 +614,7 @@ static NPY_INLINE int * #type = npy_byte, npy_short, npy_int, npy_long, npy_longlong# * #NAME = BYTE, SHORT, INT, LONG, LONGLONG# */ -static NPY_INLINE int +static inline int @name@_ctype_absolute(@type@ a, @type@ *out) { if (a == NPY_MIN_@NAME@) { @@ -631,7 +631,7 @@ static NPY_INLINE int * #type = npy_float, npy_double, npy_longdouble# * #c = f,,l# */ -static NPY_INLINE int +static inline int @name@_ctype_absolute(@type@ a, @type@ *out) { *out = npy_fabs@c@(a); @@ -639,7 +639,7 @@ static NPY_INLINE int } /**end repeat**/ -static NPY_INLINE int +static inline int half_ctype_absolute(npy_half a, npy_half *out) { *out = a&0x7fffu; @@ -652,7 +652,7 @@ half_ctype_absolute(npy_half a, npy_half *out) * #rtype = npy_float, npy_double, npy_longdouble# * #c = f,,l# */ -static NPY_INLINE int +static inline int @name@_ctype_absolute(@type@ a, @rtype@ *out) { *out = npy_cabs@c@(a); @@ -665,7 +665,7 @@ static NPY_INLINE int * ulong, longlong, ulonglong# */ -static NPY_INLINE int +static inline int @name@_ctype_invert(npy_@name@ a, npy_@name@ *out) { *out = ~a; @@ -929,7 +929,7 @@ typedef enum { * @result The result value indicating what we did with `value` or what type * of object it is (see `conversion_result`). */ -static NPY_INLINE conversion_result +static inline conversion_result convert_to_@name@(PyObject *value, @type@ *result, npy_bool *may_need_deferring) { PyArray_Descr *descr; diff --git a/numpy/core/src/umath/simd.inc.src b/numpy/core/src/umath/simd.inc.src index d6c9a7e65..5351ec1fa 100644 --- a/numpy/core/src/umath/simd.inc.src +++ b/numpy/core/src/umath/simd.inc.src @@ -61,11 +61,11 @@ */ #if defined HAVE_ATTRIBUTE_TARGET_AVX512F_WITH_INTRINSICS && defined NPY_HAVE_SSE2_INTRINSICS -static NPY_INLINE NPY_GCC_TARGET_AVX512F void +static inline NPY_GCC_TARGET_AVX512F void AVX512F_@func@_@TYPE@(@type@*, @type@*, const npy_intp n, const npy_intp stride); #endif -static NPY_INLINE int +static inline int run_unary_avx512f_@func@_@TYPE@(char **args, const npy_intp *dimensions, const npy_intp *steps) { #if defined HAVE_ATTRIBUTE_TARGET_AVX512F_WITH_INTRINSICS && defined NPY_HAVE_SSE2_INTRINSICS @@ -99,11 +99,11 @@ run_unary_avx512f_@func@_@TYPE@(char **args, const npy_intp *dimensions, const n */ #if defined HAVE_ATTRIBUTE_TARGET_AVX512_SKX_WITH_INTRINSICS && defined NPY_HAVE_SSE2_INTRINSICS && @EXISTS@ -static NPY_INLINE NPY_GCC_TARGET_AVX512_SKX void +static inline NPY_GCC_TARGET_AVX512_SKX void AVX512_SKX_@func@_@TYPE@(npy_bool*, @type@*, const npy_intp n, const npy_intp stride); #endif -static NPY_INLINE int +static inline int run_@func@_avx512_skx_@TYPE@(char **args, npy_intp const *dimensions, npy_intp const *steps) { #if defined HAVE_ATTRIBUTE_TARGET_AVX512_SKX_WITH_INTRINSICS && defined NPY_HAVE_SSE2_INTRINSICS && @EXISTS@ @@ -144,7 +144,7 @@ sse2_@func@_@TYPE@(@type@ *, @type@ *, const npy_intp n); #endif -static NPY_INLINE int +static inline int run_@name@_simd_@func@_@TYPE@(char **args, npy_intp const *dimensions, npy_intp const *steps) { #if @vector@ && defined NPY_HAVE_SSE2_INTRINSICS @@ -169,7 +169,7 @@ sse2_@kind@_@TYPE@(npy_bool * op, @type@ * ip1, npy_intp n); #endif -static NPY_INLINE int +static inline int run_@kind@_simd_@TYPE@(char **args, npy_intp const *dimensions, npy_intp const *steps) { #if @vector@ && defined NPY_HAVE_SSE2_INTRINSICS @@ -205,7 +205,7 @@ static void sse2_reduce_@kind@_BOOL(npy_bool * op, npy_bool * ip, npy_intp n); #endif -static NPY_INLINE int +static inline int run_binary_simd_@kind@_BOOL(char **args, npy_intp const *dimensions, npy_intp const *steps) { #if defined NPY_HAVE_SSE2_INTRINSICS @@ -220,7 +220,7 @@ run_binary_simd_@kind@_BOOL(char **args, npy_intp const *dimensions, npy_intp co } -static NPY_INLINE int +static inline int run_reduce_simd_@kind@_BOOL(char **args, npy_intp const *dimensions, npy_intp const *steps) { #if defined NPY_HAVE_SSE2_INTRINSICS @@ -245,7 +245,7 @@ static void sse2_@kind@_BOOL(npy_bool *, npy_bool *, const npy_intp n); #endif -static NPY_INLINE int +static inline int run_unary_simd_@kind@_BOOL(char **args, npy_intp const *dimensions, npy_intp const *steps) { #if defined NPY_HAVE_SSE2_INTRINSICS @@ -875,7 +875,7 @@ NPY_FINLINE NPY_GCC_OPT_3 NPY_GCC_TARGET_@ISA@ @vtype@d */ #if defined HAVE_ATTRIBUTE_TARGET_AVX512_SKX_WITH_INTRINSICS && defined NPY_HAVE_SSE2_INTRINSICS -static NPY_INLINE NPY_GCC_TARGET_AVX512_SKX void +static inline NPY_GCC_TARGET_AVX512_SKX void AVX512_SKX_@func@_@TYPE@(npy_bool* op, @type@* ip, const npy_intp array_size, const npy_intp steps) { const npy_intp stride_ip = steps/(npy_intp)sizeof(@type@); @@ -954,7 +954,7 @@ AVX512_SKX_@func@_@TYPE@(npy_bool* op, @type@* ip, const npy_intp array_size, co */ #if defined HAVE_ATTRIBUTE_TARGET_AVX512F_WITH_INTRINSICS && defined NPY_HAVE_SSE2_INTRINSICS -static NPY_GCC_OPT_3 NPY_INLINE NPY_GCC_TARGET_AVX512F void +static NPY_GCC_OPT_3 inline NPY_GCC_TARGET_AVX512F void AVX512F_@func@_@TYPE@(@type@ * op, @type@ * ip, const npy_intp array_size, @@ -1001,7 +1001,7 @@ AVX512F_@func@_@TYPE@(@type@ * op, /**end repeat1**/ #if defined HAVE_ATTRIBUTE_TARGET_AVX512F_WITH_INTRINSICS && defined NPY_HAVE_SSE2_INTRINSICS -static NPY_GCC_OPT_3 NPY_INLINE NPY_GCC_TARGET_AVX512F void +static NPY_GCC_OPT_3 inline NPY_GCC_TARGET_AVX512F void AVX512F_absolute_@TYPE@(@type@ * op, @type@ * ip, const npy_intp array_size, diff --git a/numpy/core/src/umath/string_ufuncs.cpp b/numpy/core/src/umath/string_ufuncs.cpp index 5a35c318b..5d82be6db 100644 --- a/numpy/core/src/umath/string_ufuncs.cpp +++ b/numpy/core/src/umath/string_ufuncs.cpp @@ -16,7 +16,7 @@ template <typename character> -static NPY_INLINE int +static inline int character_cmp(character a, character b) { if (a == b) { @@ -37,7 +37,7 @@ character_cmp(character a, character b) * is always padded with zeros). */ template <bool rstrip, typename character> -static NPY_INLINE int +static inline int string_cmp(int len1, const character *str1, int len2, const character *str2) { if (rstrip) { diff --git a/numpy/core/src/umath/ufunc_object.c b/numpy/core/src/umath/ufunc_object.c index b2955a6a5..3ac5e7ee6 100644 --- a/numpy/core/src/umath/ufunc_object.c +++ b/numpy/core/src/umath/ufunc_object.c @@ -1392,7 +1392,7 @@ try_trivial_single_output_loop(PyArrayMethod_Context *context, * or pass in the full cast information. But this can special case * the logical functions and prints a better error message. */ -static NPY_INLINE int +static inline int validate_casting(PyArrayMethodObject *method, PyUFuncObject *ufunc, PyArrayObject *ops[], PyArray_Descr *descriptors[], NPY_CASTING casting) @@ -5375,7 +5375,7 @@ cmp_arg_types(int *arg1, int *arg2, int n) * This frees the linked-list structure when the CObject * is destroyed (removed from the internal dictionary) */ -static NPY_INLINE void +static inline void _free_loop1d_list(PyUFunc_Loop1d *data) { int i; @@ -5916,7 +5916,7 @@ ufunc_reduceat(PyUFuncObject *ufunc, } /* Helper for ufunc_at, below */ -static NPY_INLINE PyArrayObject * +static inline PyArrayObject * new_array_op(PyArrayObject *op_array, char *data) { npy_intp dims[1] = {1}; diff --git a/numpy/random/_examples/cffi/parse.py b/numpy/random/_examples/cffi/parse.py index daff6bdec..d41c4c2db 100644 --- a/numpy/random/_examples/cffi/parse.py +++ b/numpy/random/_examples/cffi/parse.py @@ -36,9 +36,9 @@ def parse_distributions_h(ffi, inc_dir): continue # skip any inlined function definition - # which starts with 'static NPY_INLINE xxx(...) {' + # which starts with 'static inline xxx(...) {' # and ends with a closing '}' - if line.strip().startswith('static NPY_INLINE'): + if line.strip().startswith('static inline'): in_skip += line.count('{') continue elif in_skip > 0: @@ -48,7 +48,6 @@ def parse_distributions_h(ffi, inc_dir): # replace defines with their value or remove them line = line.replace('DECLDIR', '') - line = line.replace('NPY_INLINE', '') line = line.replace('RAND_INT_TYPE', 'int64_t') s.append(line) ffi.cdef('\n'.join(s)) diff --git a/numpy/random/include/aligned_malloc.h b/numpy/random/include/aligned_malloc.h index 43f68253d..0fff57b6c 100644 --- a/numpy/random/include/aligned_malloc.h +++ b/numpy/random/include/aligned_malloc.h @@ -6,7 +6,7 @@ #define NPY_MEMALIGN 16 /* 16 for SSE2, 32 for AVX, 64 for Xeon Phi */ -static NPY_INLINE void *PyArray_realloc_aligned(void *p, size_t n) +static inline void *PyArray_realloc_aligned(void *p, size_t n) { void *p1, **p2, *base; size_t old_offs, offs = NPY_MEMALIGN - 1 + sizeof(void *); @@ -31,12 +31,12 @@ static NPY_INLINE void *PyArray_realloc_aligned(void *p, size_t n) return (void *)p2; } -static NPY_INLINE void *PyArray_malloc_aligned(size_t n) +static inline void *PyArray_malloc_aligned(size_t n) { return PyArray_realloc_aligned(NULL, n); } -static NPY_INLINE void *PyArray_calloc_aligned(size_t n, size_t s) +static inline void *PyArray_calloc_aligned(size_t n, size_t s) { void *p; if (NPY_UNLIKELY((p = PyArray_realloc_aligned(NULL, n * s)) == NULL)) @@ -45,7 +45,7 @@ static NPY_INLINE void *PyArray_calloc_aligned(size_t n, size_t s) return p; } -static NPY_INLINE void PyArray_free_aligned(void *p) +static inline void PyArray_free_aligned(void *p) { void *base = *(((void **)p) - 1); PyMem_Free(base); diff --git a/numpy/random/src/distributions/distributions.c b/numpy/random/src/distributions/distributions.c index bd1e1faa4..9ab3f94a0 100644 --- a/numpy/random/src/distributions/distributions.c +++ b/numpy/random/src/distributions/distributions.c @@ -9,14 +9,14 @@ #include <assert.h> /* Inline generators for internal use */ -static NPY_INLINE uint32_t next_uint32(bitgen_t *bitgen_state) { +static inline uint32_t next_uint32(bitgen_t *bitgen_state) { return bitgen_state->next_uint32(bitgen_state->state); } -static NPY_INLINE uint64_t next_uint64(bitgen_t *bitgen_state) { +static inline uint64_t next_uint64(bitgen_t *bitgen_state) { return bitgen_state->next_uint64(bitgen_state->state); } -static NPY_INLINE float next_float(bitgen_t *bitgen_state) { +static inline float next_float(bitgen_t *bitgen_state) { return (next_uint32(bitgen_state) >> 8) * (1.0f / 16777216.0f); } @@ -1047,7 +1047,7 @@ uint64_t random_interval(bitgen_t *bitgen_state, uint64_t max) { } /* Bounded generators */ -static NPY_INLINE uint64_t gen_mask(uint64_t max) { +static inline uint64_t gen_mask(uint64_t max) { uint64_t mask = max; mask |= mask >> 1; mask |= mask >> 2; @@ -1059,8 +1059,8 @@ static NPY_INLINE uint64_t gen_mask(uint64_t max) { } /* Generate 16 bit random numbers using a 32 bit buffer. */ -static NPY_INLINE uint16_t buffered_uint16(bitgen_t *bitgen_state, int *bcnt, - uint32_t *buf) { +static inline uint16_t buffered_uint16(bitgen_t *bitgen_state, int *bcnt, + uint32_t *buf) { if (!(bcnt[0])) { buf[0] = next_uint32(bitgen_state); bcnt[0] = 1; @@ -1073,8 +1073,8 @@ static NPY_INLINE uint16_t buffered_uint16(bitgen_t *bitgen_state, int *bcnt, } /* Generate 8 bit random numbers using a 32 bit buffer. */ -static NPY_INLINE uint8_t buffered_uint8(bitgen_t *bitgen_state, int *bcnt, - uint32_t *buf) { +static inline uint8_t buffered_uint8(bitgen_t *bitgen_state, int *bcnt, + uint32_t *buf) { if (!(bcnt[0])) { buf[0] = next_uint32(bitgen_state); bcnt[0] = 3; @@ -1087,8 +1087,8 @@ static NPY_INLINE uint8_t buffered_uint8(bitgen_t *bitgen_state, int *bcnt, } /* Static `masked rejection` function called by random_bounded_uint64(...) */ -static NPY_INLINE uint64_t bounded_masked_uint64(bitgen_t *bitgen_state, - uint64_t rng, uint64_t mask) { +static inline uint64_t bounded_masked_uint64(bitgen_t *bitgen_state, + uint64_t rng, uint64_t mask) { uint64_t val; while ((val = (next_uint64(bitgen_state) & mask)) > rng) @@ -1099,7 +1099,7 @@ static NPY_INLINE uint64_t bounded_masked_uint64(bitgen_t *bitgen_state, /* Static `masked rejection` function called by * random_buffered_bounded_uint32(...) */ -static NPY_INLINE uint32_t +static inline uint32_t buffered_bounded_masked_uint32(bitgen_t *bitgen_state, uint32_t rng, uint32_t mask, int *bcnt, uint32_t *buf) { /* @@ -1118,7 +1118,7 @@ buffered_bounded_masked_uint32(bitgen_t *bitgen_state, uint32_t rng, /* Static `masked rejection` function called by * random_buffered_bounded_uint16(...) */ -static NPY_INLINE uint16_t +static inline uint16_t buffered_bounded_masked_uint16(bitgen_t *bitgen_state, uint16_t rng, uint16_t mask, int *bcnt, uint32_t *buf) { uint16_t val; @@ -1131,10 +1131,11 @@ buffered_bounded_masked_uint16(bitgen_t *bitgen_state, uint16_t rng, /* Static `masked rejection` function called by * random_buffered_bounded_uint8(...) */ -static NPY_INLINE uint8_t buffered_bounded_masked_uint8(bitgen_t *bitgen_state, - uint8_t rng, - uint8_t mask, int *bcnt, - uint32_t *buf) { +static inline uint8_t buffered_bounded_masked_uint8(bitgen_t *bitgen_state, + uint8_t rng, + uint8_t mask, + int *bcnt, + uint32_t *buf) { uint8_t val; while ((val = (buffered_uint8(bitgen_state, bcnt, buf) & mask)) > rng) @@ -1143,10 +1144,10 @@ static NPY_INLINE uint8_t buffered_bounded_masked_uint8(bitgen_t *bitgen_state, return val; } -static NPY_INLINE npy_bool buffered_bounded_bool(bitgen_t *bitgen_state, - npy_bool off, npy_bool rng, - npy_bool mask, int *bcnt, - uint32_t *buf) { +static inline npy_bool buffered_bounded_bool(bitgen_t *bitgen_state, + npy_bool off, npy_bool rng, + npy_bool mask, int *bcnt, + uint32_t *buf) { if (rng == 0) return off; if (!(bcnt[0])) { @@ -1160,8 +1161,8 @@ static NPY_INLINE npy_bool buffered_bounded_bool(bitgen_t *bitgen_state, } /* Static `Lemire rejection` function called by random_bounded_uint64(...) */ -static NPY_INLINE uint64_t bounded_lemire_uint64(bitgen_t *bitgen_state, - uint64_t rng) { +static inline uint64_t bounded_lemire_uint64(bitgen_t *bitgen_state, + uint64_t rng) { /* * Uses Lemire's algorithm - https://arxiv.org/abs/1805.10941 * @@ -1245,7 +1246,7 @@ static NPY_INLINE uint64_t bounded_lemire_uint64(bitgen_t *bitgen_state, /* Static `Lemire rejection` function called by * random_buffered_bounded_uint32(...) */ -static NPY_INLINE uint32_t buffered_bounded_lemire_uint32( +static inline uint32_t buffered_bounded_lemire_uint32( bitgen_t *bitgen_state, uint32_t rng, int *bcnt, uint32_t *buf) { /* * Uses Lemire's algorithm - https://arxiv.org/abs/1805.10941 @@ -1285,7 +1286,7 @@ static NPY_INLINE uint32_t buffered_bounded_lemire_uint32( /* Static `Lemire rejection` function called by * random_buffered_bounded_uint16(...) */ -static NPY_INLINE uint16_t buffered_bounded_lemire_uint16( +static inline uint16_t buffered_bounded_lemire_uint16( bitgen_t *bitgen_state, uint16_t rng, int *bcnt, uint32_t *buf) { /* * Uses Lemire's algorithm - https://arxiv.org/abs/1805.10941 @@ -1321,9 +1322,9 @@ static NPY_INLINE uint16_t buffered_bounded_lemire_uint16( /* Static `Lemire rejection` function called by * random_buffered_bounded_uint8(...) */ -static NPY_INLINE uint8_t buffered_bounded_lemire_uint8(bitgen_t *bitgen_state, - uint8_t rng, int *bcnt, - uint32_t *buf) { +static inline uint8_t buffered_bounded_lemire_uint8(bitgen_t *bitgen_state, + uint8_t rng, int *bcnt, + uint32_t *buf) { /* * Uses Lemire's algorithm - https://arxiv.org/abs/1805.10941 * diff --git a/numpy/random/src/legacy/legacy-distributions.c b/numpy/random/src/legacy/legacy-distributions.c index 443c1a4bf..b518b8a03 100644 --- a/numpy/random/src/legacy/legacy-distributions.c +++ b/numpy/random/src/legacy/legacy-distributions.c @@ -11,7 +11,7 @@ #include "include/legacy-distributions.h" -static NPY_INLINE double legacy_double(aug_bitgen_t *aug_state) { +static inline double legacy_double(aug_bitgen_t *aug_state) { return aug_state->bit_generator->next_double(aug_state->bit_generator->state); } @@ -494,4 +494,4 @@ int64_t legacy_logseries(bitgen_t *bitgen_state, double p) { } return 2; } -}
\ No newline at end of file +} diff --git a/numpy/random/src/mt19937/randomkit.c b/numpy/random/src/mt19937/randomkit.c index f8ed4b49e..e718c2d06 100644 --- a/numpy/random/src/mt19937/randomkit.c +++ b/numpy/random/src/mt19937/randomkit.c @@ -247,7 +247,7 @@ unsigned long rk_random(rk_state *state) { /* * Returns an unsigned 64 bit random integer. */ -NPY_INLINE static npy_uint64 rk_uint64(rk_state *state) { +static inline npy_uint64 rk_uint64(rk_state *state) { npy_uint64 upper = (npy_uint64)rk_random(state) << 32; npy_uint64 lower = (npy_uint64)rk_random(state); return upper | lower; @@ -256,7 +256,7 @@ NPY_INLINE static npy_uint64 rk_uint64(rk_state *state) { /* * Returns an unsigned 32 bit random integer. */ -NPY_INLINE static npy_uint32 rk_uint32(rk_state *state) { +static inline npy_uint32 rk_uint32(rk_state *state) { return (npy_uint32)rk_random(state); } diff --git a/numpy/random/src/philox/philox.c b/numpy/random/src/philox/philox.c index 6f2fad5a4..7909383e7 100644 --- a/numpy/random/src/philox/philox.c +++ b/numpy/random/src/philox/philox.c @@ -1,8 +1,8 @@ #include "philox.h" -extern NPY_INLINE uint64_t philox_next64(philox_state *state); +extern inline uint64_t philox_next64(philox_state *state); -extern NPY_INLINE uint32_t philox_next32(philox_state *state); +extern inline uint32_t philox_next32(philox_state *state); extern void philox_jump(philox_state *state) { /* Advances state as-if 2^128 draws were made */ diff --git a/numpy/random/src/philox/philox.h b/numpy/random/src/philox/philox.h index 81e034a47..ba7a67470 100644 --- a/numpy/random/src/philox/philox.h +++ b/numpy/random/src/philox/philox.h @@ -18,7 +18,7 @@ typedef struct r123array4x64 philox4x64_ctr_t; typedef struct r123array2x64 philox4x64_key_t; typedef struct r123array2x64 philox4x64_ukey_t; -static NPY_INLINE struct r123array2x64 +static inline struct r123array2x64 _philox4x64bumpkey(struct r123array2x64 key) { key.v[0] += (0x9E3779B97F4A7C15ULL); key.v[1] += (0xBB67AE8584CAA73BULL); @@ -27,7 +27,7 @@ _philox4x64bumpkey(struct r123array2x64 key) { /* Prefer uint128 if available: GCC, clang, ICC */ #ifdef __SIZEOF_INT128__ -static NPY_INLINE uint64_t mulhilo64(uint64_t a, uint64_t b, uint64_t *hip) { +static inline uint64_t mulhilo64(uint64_t a, uint64_t b, uint64_t *hip) { __uint128_t product = ((__uint128_t)a) * ((__uint128_t)b); *hip = product >> 64; return (uint64_t)product; @@ -39,13 +39,13 @@ static NPY_INLINE uint64_t mulhilo64(uint64_t a, uint64_t b, uint64_t *hip) { #pragma intrinsic(_umul128) #elif defined(_WIN64) && defined(_M_ARM64) #pragma intrinsic(__umulh) -static NPY_INLINE uint64_t _umul128(uint64_t a, uint64_t b, uint64_t *high) { +static inline uint64_t _umul128(uint64_t a, uint64_t b, uint64_t *high) { *high = __umulh(a, b); return a * b; } #else #pragma intrinsic(__emulu) -static NPY_INLINE uint64_t _umul128(uint64_t a, uint64_t b, uint64_t *high) { +static inline uint64_t _umul128(uint64_t a, uint64_t b, uint64_t *high) { uint64_t a_lo, a_hi, b_lo, b_hi, a_x_b_hi, a_x_b_mid, a_x_b_lo, b_x_a_mid, carry_bit; @@ -68,11 +68,11 @@ static NPY_INLINE uint64_t _umul128(uint64_t a, uint64_t b, uint64_t *high) { return a_x_b_lo + ((a_x_b_mid + b_x_a_mid) << 32); } #endif -static NPY_INLINE uint64_t mulhilo64(uint64_t a, uint64_t b, uint64_t *hip) { +static inline uint64_t mulhilo64(uint64_t a, uint64_t b, uint64_t *hip) { return _umul128(a, b, hip); } #else -static NPY_INLINE uint64_t _umul128(uint64_t a, uint64_t b, uint64_t *high) { +static inline uint64_t _umul128(uint64_t a, uint64_t b, uint64_t *high) { uint64_t a_lo, a_hi, b_lo, b_hi, a_x_b_hi, a_x_b_mid, a_x_b_lo, b_x_a_mid, carry_bit; @@ -94,16 +94,16 @@ static NPY_INLINE uint64_t _umul128(uint64_t a, uint64_t b, uint64_t *high) { return a_x_b_lo + ((a_x_b_mid + b_x_a_mid) << 32); } -static NPY_INLINE uint64_t mulhilo64(uint64_t a, uint64_t b, uint64_t *hip) { +static inline uint64_t mulhilo64(uint64_t a, uint64_t b, uint64_t *hip) { return _umul128(a, b, hip); } #endif #endif -static NPY_INLINE struct r123array4x64 _philox4x64round(struct r123array4x64 ctr, +static inline struct r123array4x64 _philox4x64round(struct r123array4x64 ctr, struct r123array2x64 key); -static NPY_INLINE struct r123array4x64 _philox4x64round(struct r123array4x64 ctr, +static inline struct r123array4x64 _philox4x64round(struct r123array4x64 ctr, struct r123array2x64 key) { uint64_t hi0; uint64_t hi1; @@ -114,14 +114,14 @@ static NPY_INLINE struct r123array4x64 _philox4x64round(struct r123array4x64 ctr return out; } -static NPY_INLINE philox4x64_key_t philox4x64keyinit(philox4x64_ukey_t uk) { +static inline philox4x64_key_t philox4x64keyinit(philox4x64_ukey_t uk) { return uk; } -static NPY_INLINE philox4x64_ctr_t philox4x64_R(unsigned int R, +static inline philox4x64_ctr_t philox4x64_R(unsigned int R, philox4x64_ctr_t ctr, philox4x64_key_t key); -static NPY_INLINE philox4x64_ctr_t philox4x64_R(unsigned int R, +static inline philox4x64_ctr_t philox4x64_R(unsigned int R, philox4x64_ctr_t ctr, philox4x64_key_t key) { if (R > 0) { @@ -199,7 +199,7 @@ typedef struct s_philox_state { uint32_t uinteger; } philox_state; -static NPY_INLINE uint64_t philox_next(philox_state *state) { +static inline uint64_t philox_next(philox_state *state) { uint64_t out; int i; philox4x64_ctr_t ct; @@ -229,11 +229,11 @@ static NPY_INLINE uint64_t philox_next(philox_state *state) { return state->buffer[0]; } -static NPY_INLINE uint64_t philox_next64(philox_state *state) { +static inline uint64_t philox_next64(philox_state *state) { return philox_next(state); } -static NPY_INLINE uint32_t philox_next32(philox_state *state) { +static inline uint32_t philox_next32(philox_state *state) { uint64_t next; if (state->has_uint32) { diff --git a/numpy/random/src/sfc64/sfc64.h b/numpy/random/src/sfc64/sfc64.h index 75c4118d3..f6526063e 100644 --- a/numpy/random/src/sfc64/sfc64.h +++ b/numpy/random/src/sfc64/sfc64.h @@ -14,7 +14,7 @@ typedef struct s_sfc64_state { } sfc64_state; -static NPY_INLINE uint64_t rotl(const uint64_t value, unsigned int rot) { +static inline uint64_t rotl(const uint64_t value, unsigned int rot) { #ifdef _WIN32 return _rotl64(value, rot); #else @@ -22,7 +22,7 @@ static NPY_INLINE uint64_t rotl(const uint64_t value, unsigned int rot) { #endif } -static NPY_INLINE uint64_t sfc64_next(uint64_t *s) { +static inline uint64_t sfc64_next(uint64_t *s) { const uint64_t tmp = s[0] + s[1] + s[3]++; s[0] = s[1] ^ (s[1] >> 11); @@ -33,11 +33,11 @@ static NPY_INLINE uint64_t sfc64_next(uint64_t *s) { } -static NPY_INLINE uint64_t sfc64_next64(sfc64_state *state) { +static inline uint64_t sfc64_next64(sfc64_state *state) { return sfc64_next(&state->s[0]); } -static NPY_INLINE uint32_t sfc64_next32(sfc64_state *state) { +static inline uint32_t sfc64_next32(sfc64_state *state) { uint64_t next; if (state->has_uint32) { state->has_uint32 = 0; |