Skip to content

Commit 50ad876

Browse files
MAINT: Small tweak to minmax_gufunc.h
1 parent 32706e9 commit 50ad876

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/minmax/minmax_gufunc.h

+3-6
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "Python.h"
66

77
#include <stdbool.h>
8+
#include <algorithm>
89

910
#define NPY_NO_DEPRECATED_API NPY_API_VERSION
1011
#include "numpy/ndarraytypes.h"
@@ -27,12 +28,8 @@ static void minmax_core(
2728

2829
for (npy_intp k = 1; k < n; ++k) {
2930
T x = get(p_x, x_stride, k);
30-
if (x < xmin) {
31-
xmin = x;
32-
}
33-
else if (x > xmax) {
34-
xmax = x;
35-
}
31+
xmin = std::min(xmin, x);
32+
xmax = std::max(xmax, x);
3633
}
3734
*p_out = xmin;
3835
set(p_out, out_stride, 1, xmax);

0 commit comments

Comments
 (0)