8000 Fix binsearch.cpp build · numpy/numpy@4670308 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4670308

Browse files
Fix binsearch.cpp build
1 parent 62868e4 commit 4670308

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

numpy/core/src/npysort/binsearch.cpp

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313
#include <functional> // for std::less and std::less_equal
1414

1515
// Enumerators for the variant of binsearch
16-
enum arg_t
16+
enum class arg_t
1717
{
1818
noarg,
1919
arg
2020
};
21-
enum side_t
21+
enum class side_t
2222
{
2323
left,
2424
right
@@ -29,25 +29,25 @@ template <class Tag, side_t side>
2929
struct side_to_cmp;
3030

3131
template <class Tag>
32-
struct side_to_cmp<Tag, left> {
32+
struct side_to_cmp<Tag, side_t::left> {
3333
static constexpr auto value = Tag::less;
3434
};
3535

3636
template <class Tag>
37-
struct side_to_cmp<Tag, right> {
37+
struct side_to_cmp<Tag, side_t::right> {
3838
static constexpr auto value = Tag::less_equal;
3939
};
4040

4141
template <side_t side>
4242
struct side_to_generic_cmp;
4343

4444
template <>
45-
struct side_to_generic_cmp<left> {
45+
struct side_to_generic_cmp<side_t::left> {
4646
using type = std::less<int>;
4747
};
4848

4949
template <>
50-
struct side_to_generic_cmp<right> {
50+
struct side_to_generic_cmp<side_t::right> {
5151
using type = std::less_equal<int>;
5252
};
5353

@@ -273,7 +273,7 @@ template <arg_t arg>
273273
struct binsearch_base;
274274

275275
template <>
276-
struct binsearch_base<arg> {
276+
struct binsearch_base<arg_t::arg> {
277277
using function_type = PyArray_ArgBinSearchFunc *;
278278
struct value_type {
279279
int typenum;
@@ -285,18 +285,18 @@ struct binsearch_base<arg> {
285285
{
286286
return std::array<value_type, sizeof...(Tags)>{
287287
value_type{Tags::type_value,
288-
{(function_type)&argbinsearch<Tags, left>,
289-
(function_type)argbinsearch<Tags, right>}}...};
288+
{(function_type)&argbinsearch<Tags, side_t::left>,
289+
(function_type)argbinsearch<Tags, side_t::right>}}...};
290290
}
291291
static constexpr std::array<function_type, 2> npy_map = {
292-
(function_type)&npy_argbinsearch<left>,
293-
(function_type)&npy_argbinsearch<right>};
292+
(function_type)&npy_argbinsearch<side_t::left>,
293+
(function_type)&npy_argbinsearch<side_t::right>};
294294
};
295-
constexpr std::array<binsearch_base<arg>::function_type, 2>
296-
binsearch_base<arg>::npy_map;
295+
constexpr std::array<binsearch_base<arg_t::arg>::function_type, 2>
296+
binsearch_base<arg_t::arg>::npy_map;
297297

298298
template <>
299-
struct binsearch_base<noarg> {
299+
struct binsearch_base<arg_t::noarg> {
300300
using function_type = PyArray_BinSearchFunc *;
301301
struct value_type {
302302
int typenum;
@@ -308,15 +308,15 @@ struct binsearch_base<noarg> {
308308
{
309309
return std::array<value_type, sizeof...(Tags)>{
310310
value_type{Tags::type_value,
311-
{(function_type)&binsearch<Tags, left>,
312-
(function_type)binsearch<Tags, right>}}...};
311+
{(function_type)&binsearch<Tags, side_t::left>,
312+
(function_type)binsearch<Tags, side_t::right>}}...};
313313
}
314314
static constexpr std::array<function_type, 2> npy_map = {
315-
(function_type)&npy_binsearch<left>,
316-
(function_type)&npy_binsearch<right>};
315+
(function_type)&npy_binsearch<side_t::left>,
316+
(function_type)&npy_binsearch<side_t::right>};
317317
};
318-
constexpr std::array<binsearch_base<noarg>::function_type, 2>
319-
binsearch_base<noarg>::npy_map;
318+
constexpr std::array<binsearch_base<arg_t::noarg>::function_type, 2>
319+
binsearch_base<arg_t::noarg>::npy_map;
320320

321321
// Handle generation of all binsearch variants
322322
template <arg_t arg>
@@ -392,12 +392,12 @@ extern "C" {
392392
NPY_NO_EXPORT PyArray_BinSearchFunc *
393393
get_binsearch_func(PyArray_Descr *dtype, NPY_SEARCHSIDE side)
394394
{
395-
return _get_binsearch_func<noarg>(dtype, side);
395+
return _get_binsearch_func<arg_t::noarg>(dtype, side);
396396
}
397397

398398
NPY_NO_EXPORT PyArray_ArgBinSearchFunc *
399399
get_argbinsearch_func(PyArray_Descr *dtype, NPY_SEARCHSIDE side)
400400
{
401-
return _get_binsearch_func<arg>(dtype, side);
401+
return _get_binsearch_func<arg_t::arg>(dtype, side);
402402
}
403403
}

0 commit comments

Comments
 (0)
0