diff options
| author | Ralf Gommers <ralf.gommers@gmail.com> | 2022-11-25 15:02:13 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-11-25 15:02:13 +0100 |
| commit | d4b2d4f80060285ac085ea874aceaf9fa1bfb757 (patch) | |
| tree | 34ab154de41ee4a6a0ddf1eb88f1661438645d0e /numpy/core/src/common | |
| parent | 73cf4dd9efba42c914b4cea2e61877e72598c75c (diff) | |
| parent | 3947b1a023a07a55522de65b4d302339bac2bad7 (diff) | |
| download | numpy-d4b2d4f80060285ac085ea874aceaf9fa1bfb757.tar.gz | |
Merge pull request #22674 from rgommers/npy-inline-cleanup
MAINT: replace `NPY_INLINE` with `inline`
[ci skip]
Diffstat (limited to 'numpy/core/src/common')
| -rw-r--r-- | numpy/core/src/common/get_attr_string.h | 6 | ||||
| -rw-r--r-- | numpy/core/src/common/lowlevel_strided_loops.h | 18 | ||||
| -rw-r--r-- | numpy/core/src/common/npy_cblas.h | 2 | ||||
| -rw-r--r-- | numpy/core/src/common/npy_ctypes.h | 2 | ||||
| -rw-r--r-- | numpy/core/src/common/npy_extint128.h | 30 | ||||
| -rw-r--r-- | numpy/core/src/common/npy_hashtable.c | 4 | ||||
| -rw-r--r-- | numpy/core/src/common/npy_import.h | 2 | ||||
| -rw-r--r-- | numpy/core/src/common/npy_pycompat.h | 2 | ||||
| -rw-r--r-- | numpy/core/src/common/npy_sort.h.src | 2 | ||||
| -rw-r--r-- | numpy/core/src/common/templ_common.h.src | 4 |
10 files changed, 36 insertions, 36 deletions
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 |
