| 2923 | |
| 2924 | |
| 2925 | static int |
| 2926 | reduce_loop(PyArrayMethod_Context *context, |
| 2927 | PyArrayMethod_StridedLoop *strided_loop, NpyAuxData *auxdata, |
| 2928 | NpyIter *iter, char **dataptrs, npy_intp const *strides, |
| 2929 | npy_intp const *countptr, NpyIter_IterNextFunc *iternext, |
| 2930 | int needs_api, npy_intp skip_first_count) |
| 2931 | { |
| 2932 | int retval = 0; |
| 2933 | char *dataptrs_copy[4]; |
| 2934 | npy_intp strides_copy[4]; |
| 2935 | npy_bool masked; |
| 2936 | |
| 2937 | NPY_BEGIN_THREADS_DEF; |
| 2938 | /* Get the number of operands, to determine whether "where" is used */ |
| 2939 | masked = (NpyIter_GetNOp(iter) == 3); |
| 2940 | |
| 2941 | if (!needs_api) { |
| 2942 | NPY_BEGIN_THREADS_THRESHOLDED(NpyIter_GetIterSize(iter)); |
| 2943 | } |
| 2944 | |
| 2945 | if (skip_first_count > 0) { |
| 2946 | assert(!masked); /* Path currently not available for masked */ |
| 2947 | while (1) { |
| 2948 | npy_intp count = *countptr; |
| 2949 | |
| 2950 | /* Skip any first-visit elements */ |
| 2951 | if (NpyIter_IsFirstVisit(iter, 0)) { |
| 2952 | if (strides[0] == 0) { |
| 2953 | --count; |
| 2954 | --skip_first_count; |
| 2955 | dataptrs[1] += strides[1]; |
| 2956 | } |
| 2957 | else { |
| 2958 | skip_first_count -= count; |
| 2959 | count = 0; |
| 2960 | } |
| 2961 | } |
| 2962 | if (count > 0) { |
| 2963 | /* Turn the two items into three for the inner loop */ |
| 2964 | dataptrs_copy[0] = dataptrs[0]; |
| 2965 | dataptrs_copy[1] = dataptrs[1]; |
| 2966 | dataptrs_copy[2] = dataptrs[0]; |
| 2967 | strides_copy[0] = strides[0]; |
| 2968 | strides_copy[1] = strides[1]; |
| 2969 | strides_copy[2] = strides[0]; |
| 2970 | |
| 2971 | retval = strided_loop(context, |
| 2972 | dataptrs_copy, &count, strides_copy, auxdata); |
| 2973 | if (retval < 0) { |
| 2974 | goto finish_loop; |
| 2975 | } |
| 2976 | } |
| 2977 | |
| 2978 | /* Advance loop, and abort on error (or finish) */ |
| 2979 | if (!iternext(iter)) { |
| 2980 | goto finish_loop; |
| 2981 | } |
| 2982 |
nothing calls this directly
no test coverage detected