summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authormattip <matti.picus@gmail.com>2023-02-05 13:54:49 +0200
committermattip <matti.picus@gmail.com>2023-02-05 19:54:07 +0200
commit3802b1664706fc71dac6d8932084e8b246e1770d (patch)
tree69eb366c0530b3f7eaa3592039906cbc5d3eb1c5 /numpy
parent6541cf5c607a3b9500d04551dc28bfbecd1fc7a6 (diff)
downloadnumpy-3802b1664706fc71dac6d8932084e8b246e1770d.tar.gz
MAINT: rework release note, changes from review
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/src/multiarray/argfunc.dispatch.c.src4
-rw-r--r--numpy/core/src/umath/loops.c.src12
-rw-r--r--numpy/core/src/umath/loops_arithm_fp.dispatch.c.src8
-rw-r--r--numpy/core/src/umath/loops_arithmetic.dispatch.c.src18
-rw-r--r--numpy/core/src/umath/ufunc_object.c10
5 files changed, 27 insertions, 25 deletions
diff --git a/numpy/core/src/multiarray/argfunc.dispatch.c.src b/numpy/core/src/multiarray/argfunc.dispatch.c.src
index 88c1028dc..d79be1df5 100644
--- a/numpy/core/src/multiarray/argfunc.dispatch.c.src
+++ b/numpy/core/src/multiarray/argfunc.dispatch.c.src
@@ -194,7 +194,7 @@ simd_@func@_@sfx@(npyv_lanetype_@sfx@ *ip, npy_intp len)
npyv_@bsfx@ nnan_ab = npyv_and_@bsfx@(nnan_a, nnan_b);
npyv_@bsfx@ nnan_cd = npyv_and_@bsfx@(nnan_c, nnan_d);
npy_uint64 nnan = npyv_tobits_@bsfx@(npyv_and_@bsfx@(nnan_ab, nnan_cd));
- if ((long long int)nnan != ((1LL << vstep) - 1)) {
+ if ((unsigned long long int)nnan != ((1ULL << vstep) - 1)) {
npy_uint64 nnan_4[4];
nnan_4[0] = npyv_tobits_@bsfx@(nnan_a);
nnan_4[1] = npyv_tobits_@bsfx@(nnan_b);
@@ -219,7 +219,7 @@ simd_@func@_@sfx@(npyv_lanetype_@sfx@ *ip, npy_intp len)
#if @is_fp@
npyv_@bsfx@ nnan_a = npyv_notnan_@sfx@(a);
npy_uint64 nnan = npyv_tobits_@bsfx@(nnan_a);
- if ((long long int)nnan != ((1LL << vstep) - 1)) {
+ if ((unsigned long long int)nnan != ((1ULL << vstep) - 1)) {
for (int vi = 0; vi < vstep; ++vi) {
if (!((nnan >> vi) & 1)) {
return i + vi;
diff --git a/numpy/core/src/umath/loops.c.src b/numpy/core/src/umath/loops.c.src
index 87ef2fca9..038dc0a2b 100644
--- a/numpy/core/src/umath/loops.c.src
+++ b/numpy/core/src/umath/loops.c.src
@@ -557,7 +557,7 @@ NPY_NO_EXPORT NPY_GCC_OPT_3 @ATTR@ int
@type@ *indexed;
for(i = 0; i < n; i++, indx += isindex, value += isb) {
indexed = (@type@ *)(ip1 + is1 * *(npy_intp *)indx);
- indexed[0] = indexed[0] @OP@ *(@type@ *)value;
+ *indexed = *indexed @OP@ *(@type@ *)value;
}
return 0;
}
@@ -1436,7 +1436,7 @@ NPY_NO_EXPORT int
@type@ *indexed;
for(i = 0; i < n; i++, indx += isindex, value += isb) {
indexed = (@type@ *)(ip1 + is1 * *(npy_intp *)indx);
- indexed[0] = npy_floor_divide@c@(indexed[0], *(@type@ *)value);
+ *indexed = npy_floor_divide@c@(*indexed, *(@type@ *)value);
}
return 0;
}
@@ -1590,7 +1590,7 @@ LONGDOUBLE_@kind@_indexed(PyArrayMethod_Context *NPY_UNUSED(context),
npy_longdouble *indexed;
for(i = 0; i < n; i++, indx += isindex, value += isb) {
indexed = (npy_longdouble *)(ip1 + is1 * *(npy_intp *)indx);
- indexed[0] = indexed[0] @OP@ *(npy_longdouble *)value;
+ *indexed = *indexed @OP@ *(npy_longdouble *)value;
}
return 0;
}
@@ -1714,7 +1714,7 @@ HALF_@kind@_indexed(void *NPY_UNUSED(context), char **args, npy_intp const *dime
for(i = 0; i < n; i++, indx += isindex, value += isb) {
indexed = (npy_half *)(ip1 + is1 * *(npy_intp *)indx);
const float v = npy_half_to_float(*(npy_half *)value);
- indexed[0] = npy_float_to_half(npy_half_to_float(indexed[0]) @OP@ v);
+ *indexed = npy_float_to_half(npy_half_to_float(*indexed) @OP@ v);
}
return 0;
}
@@ -1869,8 +1869,8 @@ HALF_floor_divide_indexed(PyArrayMethod_Context *NPY_UNUSED(context),
for(i = 0; i < n; i++, indx += isindex, value += isb) {
indexed = (npy_half *)(ip1 + is1 * *(npy_intp *)indx);
float v = npy_half_to_float(*(npy_half *)value);
- float div = npy_floor_dividef(npy_half_to_float(indexed[0]), v);
- indexed[0] = npy_float_to_half(div);
+ float div = npy_floor_dividef(npy_half_to_float(*indexed), v);
+ *indexed = npy_float_to_half(div);
}
return 0;
}
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 a00ef1e4b..9bce0029f 100644
--- a/numpy/core/src/umath/loops_arithm_fp.dispatch.c.src
+++ b/numpy/core/src/umath/loops_arithm_fp.dispatch.c.src
@@ -551,15 +551,15 @@ NPY_NO_EXPORT int NPY_CPU_DISPATCH_CURFX(@TYPE@_@kind@_indexed)
(PyArrayMethod_Context *NPY_UNUSED(context), char * const*args, npy_intp const *dimensions, npy_intp const *steps, NpyAuxData *NPY_UNUSED(func))
{
char *ip1 = args[0];
- npy_intp *indx = (npy_intp *)args[1];
+ char *indx = args[1];
char *value = args[2];
- npy_intp is1 = steps[0], isindex = steps[1] / sizeof(npy_intp), isb = steps[2];
+ npy_intp is1 = steps[0], isindex = steps[1], isb = steps[2];
npy_intp n = dimensions[0];
npy_intp i;
@type@ *indexed;
for(i = 0; i < n; i++, indx += isindex, value += isb) {
- indexed = (@type@ *)(ip1 + is1 * indx[0]);
- indexed[0] = indexed[0] @OP@ *(@type@ *)value;
+ indexed = (@type@ *)(ip1 + is1 * *(npy_intp *)indx);
+ *indexed = *indexed @OP@ *(@type@ *)value;
}
return 0;
}
diff --git a/numpy/core/src/umath/loops_arithmetic.dispatch.c.src b/numpy/core/src/umath/loops_arithmetic.dispatch.c.src
index 9f3043f48..b6f126298 100644
--- a/numpy/core/src/umath/loops_arithmetic.dispatch.c.src
+++ b/numpy/core/src/umath/loops_arithmetic.dispatch.c.src
@@ -400,15 +400,15 @@ NPY_NO_EXPORT int NPY_CPU_DISPATCH_CURFX(@TYPE@_divide_indexed)
(PyArrayMethod_Context *NPY_UNUSED(context), char * const*args, npy_intp const *dimensions, npy_intp const *steps, NpyAuxData *NPY_UNUSED(func))
{
char *ip1 = args[0];
- npy_intp *indx = (npy_intp *)args[1];
+ char *indx = args[1];
char *value = args[2];
- npy_intp is1 = steps[0], isindex = steps[1] / sizeof(npy_intp), isb = steps[2];
+ npy_intp is1 = steps[0], isindex = steps[1], isb = steps[2];
npy_intp n = dimensions[0];
npy_intp i;
@type@ *indexed;
for(i = 0; i < n; i++, indx += isindex, value += isb) {
- indexed = (@type@ *)(ip1 + is1 * indx[0]);
- indexed[0] = floor_div_@TYPE@(indexed[0], *(@type@ *)value);
+ indexed = (@type@ *)(ip1 + is1 * *(npy_intp *)indx);
+ *indexed = floor_div_@TYPE@(*indexed, *(@type@ *)value);
}
return 0;
}
@@ -486,20 +486,20 @@ NPY_NO_EXPORT int NPY_CPU_DISPATCH_CURFX(@TYPE@_divide_indexed)
(PyArrayMethod_Context *NPY_UNUSED(context), char * const*args, npy_intp const *dimensions, npy_intp const *steps, NpyAuxData *NPY_UNUSED(func))
{
char *ip1 = args[0];
- npy_intp *indx = (npy_intp *)args[1];
+ char *indx = args[1];
char *value = args[2];
- npy_intp is1 = steps[0], isindex = steps[1] / sizeof(npy_intp), isb = steps[2];
+ npy_intp is1 = steps[0], isindex = steps[1], isb = steps[2];
npy_intp n = dimensions[0];
npy_intp i;
@type@ *indexed;
for(i = 0; i < n; i++, indx += isindex, value += isb) {
- indexed = (@type@ *)(ip1 + is1 * indx[0]);
+ indexed = (@type@ *)(ip1 + is1 * *(npy_intp *)indx);
@type@ in2 = *(@type@ *)value;
if (NPY_UNLIKELY(in2 == 0)) {
npy_set_floatstatus_divbyzero();
- indexed[0] = 0;
+ *indexed = 0;
} else {
- indexed[0] = indexed[0] / in2;
+ *indexed = *indexed / in2;
}
}
return 0;
diff --git a/numpy/core/src/umath/ufunc_object.c b/numpy/core/src/umath/ufunc_object.c
index 5f199129f..fa10e154f 100644
--- a/numpy/core/src/umath/ufunc_object.c
+++ b/numpy/core/src/umath/ufunc_object.c
@@ -5906,10 +5906,6 @@ trivial_at_loop(PyArrayMethodObject *ufuncimpl, NPY_ARRAYMETHOD_FLAGS flags,
int buffersize=0, errormask = 0;
int res;
char *args[3];
- const char * ufunc_name = ufunc_get_name_cstr((PyUFuncObject *)context->caller);
- if (_get_bufsize_errmask(NULL, ufunc_name, &buffersize, &errormask) < 0) {
- return -1;
- }
npy_intp dimensions = iter->size;
npy_intp steps[3];
args[0] = (char *) iter->baseoffset;
@@ -5929,6 +5925,12 @@ trivial_at_loop(PyArrayMethodObject *ufuncimpl, NPY_ARRAYMETHOD_FLAGS flags,
}
if (res == 0 && !(flags & NPY_METH_NO_FLOATINGPOINT_ERRORS)) {
+ const char * ufunc_name =
+ ufunc_get_name_cstr((PyUFuncObject *)context->caller);
+ if (_get_bufsize_errmask(NULL, ufunc_name,
+ &buffersize, &errormask) < 0) {
+ return -1;
+ }
res = _check_ufunc_fperr(errormask, NULL, ufunc_name);
}
return res;