8000 BLD: keep VC happy by moving inlined variable definitions to top · numpy/numpy@bacbf75 · GitHub
[go: up one dir, main page]

Skip to content

Commit bacbf75

Browse files
87mwiebe
authored andcommitted
BLD: keep VC happy by moving inlined variable definitions to top
1 parent b4075c3 commit bacbf75

File tree

2 files changed

+27
-15
lines changed

2 files changed

+27
-15
lines changed

numpy/core/src/multiarray/mapping.c

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -847,10 +847,12 @@ array_boolean_subscript(PyArrayObject *self,
847847
npy_intp self_stride = innerstrides[0];
848848
npy_intp bmask_stride = innerstrides[1];
849849
npy_intp subloopsize;
850+
char *self_data;
851+
char *bmask_data;
850852
do {
851853
innersize = *NpyIter_GetInnerLoopSizePtr(iter);
852-
char *self_data = dataptrs[0];
853-
char *bmask_data = dataptrs[1];
854+
self_data = dataptrs[0];
855+
bmask_data = dataptrs[1];
854856

< 8000 code>855857
while (innersize > 0) {
856858
/* Skip masked values */
@@ -882,11 +884,14 @@ array_boolean_subscript(PyArrayObject *self,
882884
npy_intp bmask_stride = innerstrides[1];
883885
npy_intp maskna_stride = innerstrides[2];
884886
npy_intp subloopsize;
887+
char *self_data;
888+
char *bmask_data;
889+
char *maskna_data;
885890
do {
886891
innersize = *NpyIter_GetInnerLoopSizePtr(iter);
887-
char *self_data = dataptrs[0];
888-
char *bmask_data = dataptrs[1];
889-
char *maskna_data = dataptrs[2];
892+
self_data = dataptrs[0];
893+
bmask_data = dataptrs[1];
894+
maskna_data = dataptrs[2];
890895

891896
while (innersize > 0) {
892897
/* Skip masked values */
@@ -1098,6 +1103,8 @@ array_ass_boolean_subscript(PyArrayObject *self,
10981103
npy_intp self_stride = innerstrides[0];
10991104
npy_intp bmask_stride = innerstrides[1];
11001105
npy_intp subloopsize;
1106+
char *self_data;
1107+
char *bmask_data;
11011108

11021109
/* Get a dtype transfer function */
11031110
NpyIter_GetInnerFixedStrideArray(iter, fixed_strides);
@@ -1114,8 +1121,8 @@ array_ass_boolean_subscript(PyArrayObject *self,
11141121

11151122
do {
11161123
innersize = *NpyIter_GetInnerLoopSizePtr(iter);
1117-
char *self_data = dataptrs[0];
1118-
char *bmask_data = dataptrs[1];
1124+
self_data = dataptrs[0];
1125+
bmask_data = dataptrs[1];
11191126

11201127
while (innersize > 0) {
11211128
/* Skip masked values */
@@ -1152,6 +1159,9 @@ array_ass_boolean_subscript(PyArrayObject *self,
11521159
npy_intp self_maskna_stride = innerstrides[2];
11531160
npy_intp subloopsize;
11541161
PyArray_Descr *v_maskna_dtype;
1162+
char *self_data;
1163+
char *bmask_data;
1164+
char *self_maskna_data;
11551165

11561166
if (PyArray_HASMASKNA(v)) {
11571167
v_maskna_dtype = PyArray_MASKNA_DTYPE(v);
@@ -1184,9 +1194,9 @@ array_ass_boolean_subscript(PyArrayObject *self,
11841194

11851195
do {
11861196
innersize = *NpyIter_GetInnerLoopSizePtr(iter);
1187-
char *self_data = dataptrs[0];
1188-
char *bmask_data = dataptrs[1];
1189-
char *self_maskna_data = dataptrs[2];
1197+
self_data = dataptrs[0];
1198+
bmask_data = dataptrs[1];
1199+
self_maskna_data = dataptrs[2];
11901200

11911201
while (innersize > 0) {
11921202
/* Skip masked values */

numpy/core/src/umath/ufunc_object.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2627,7 +2627,6 @@ PyUFunc_Reduce(PyUFuncObject *self, PyArrayObject *arr, PyArrayObject *out,
26272627
NpyAuxData *maskedinnerloopdata = NULL;
26282628

26292629
char *ufunc_name = self->name ? self->name : "(unknown)";
2630-
NPY_BEGIN_THREADS_DEF;
26312630

26322631
/* These parameters come from a TLS global */
26332632
int buffersize = 0, errormask = 0;
@@ -2639,6 +2638,8 @@ PyUFunc_Reduce(PyUFuncObject *self, PyArrayObject *arr, PyArrayObject *out,
26392638
PyArray_Descr *op_dtypes[2] = {NULL, NULL};
26402639
npy_uint32 flags, op_flags[2];
26412640

2641+
NPY_BEGIN_THREADS_DEF;
2642+
26422643
ndim = PyArray_NDIM(arr);
26432644

26442645
if (PyUFunc_GetPyValues("reduce", &buffersize, &errormask, &errobj) < 0) {
@@ -3155,6 +3156,7 @@ PyUFunc_Accumulate(PyUFuncObject *self, PyArrayObject *arr, PyArrayObject *out,
31553156
if (iter && NpyIter_GetIterSize(iter) != 0) {
31563157
char *dataptr_copy[3];
31573158
npy_intp stride_copy[3];
3159+
npy_intp count_m1, stride0, stride1;
31583160

31593161
NpyIter_IterNextFunc *iternext;
31603162
char **dataptr;
@@ -3170,8 +3172,8 @@ PyUFunc_Accumulate(PyUFuncObject *self, PyArrayObject *arr, PyArrayObject *out,
31703172

31713173

31723174
/* Execute the loop with just the outer iterator */
3173-
npy_intp count_m1 = PyArray_DIM(op[1], axis)-1;
3174-
npy_intp stride0 = 0, stride1 = PyArray_STRIDE(op[1], axis);
3175+
count_m1 = PyArray_DIM(op[1], axis)-1;
3176+
stride0 = 0, stride1 = PyArray_STRIDE(op[1], axis);
31753177

31763178
NPY_UF_DBG_PRINT("UFunc: Reduce loop with just outer iterator\n");
31773179

@@ -3361,14 +3363,14 @@ PyUFunc_Reduceat(PyUFuncObject *self, PyArrayObject *arr, PyArrayObject *ind,
33613363
int buffersize = 0, errormask = 0;
33623364
PyObject *errobj = NULL;
33633365

3366+
NPY_BEGIN_THREADS_DEF;
3367+
33643368
if (PyArray_HASMASKNA(arr)) {
33653369
PyErr_SetString(PyExc_RuntimeError,
33663370
"ufunc reduceat doesn't support NA masked arrays yet");
33673371
return NULL;
33683372
}
33693373

3370-
NPY_BEGIN_THREADS_DEF;
3371-
33723374
reduceat_ind = (npy_intp *)PyArray_DATA(ind);
33733375
ind_size = PyArray_DIM(ind, 0);
33743376
red_axis_size = PyArray_DIM(arr, axis);

0 commit comments

Comments
 (0)
0