Skip to content

Commit 1f14d2c

Browse files
committed
🎨 Remove C++23 dependency for pseudo_pext benchmark
1 parent c452525 commit 1f14d2c

File tree

2 files changed

+15
-17
lines changed

2 files changed

+15
-17
lines changed

benchmark/lookup/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ foreach(BENCH_ALG_NAME ${BENCH_ALG_NAMES})
7272
cib_lookup
7373
mph
7474
frozen-headers)
75-
target_compile_features(${name} PRIVATE cxx_std_23)
7675
target_compile_options(${name} PRIVATE -fconstexpr-steps=4000000000)
7776
target_compile_definitions(
7877
${name}

benchmark/lookup/algorithms/pseudo_pext.hpp

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,24 @@
99

1010
#include <nanobench.h>
1111

12-
template <auto data, typename T, bool indirect = true,
13-
std::size_t max_search_len = 2>
14-
constexpr auto make_pseudo_pext() {
15-
constexpr static auto input_data = []() {
16-
std::array<lookup::entry<T, T>, data.size()> d{};
17-
18-
for (auto i = std::size_t{}; i < d.size(); i++) {
19-
d[i] = {static_cast<T>(data[i].first),
20-
static_cast<T>(data[i].second)};
21-
}
12+
namespace pp {
13+
template <auto data, typename T>
14+
constexpr auto input_data = []() {
15+
std::array<lookup::entry<T, T>, data.size()> d{};
2216

23-
return d;
24-
}();
17+
for (auto i = std::size_t{}; i < d.size(); i++) {
18+
d[i] = {static_cast<T>(data[i].first), static_cast<T>(data[i].second)};
19+
}
2520

26-
constexpr static auto map =
27-
lookup::pseudo_pext_lookup<indirect, max_search_len>::make(
28-
CX_VALUE(lookup::input{0, input_data}));
21+
return d;
22+
}();
23+
} // namespace pp
2924

30-
return map;
25+
template <auto data, typename T, bool indirect = true,
26+
std::size_t max_search_len = 2>
27+
constexpr auto make_pseudo_pext() {
28+
return lookup::pseudo_pext_lookup<indirect, max_search_len>::make(
29+
CX_VALUE(lookup::input{0, pp::input_data<data, T>}));
3130
}
3231

3332
template <auto data, typename T, bool indirect = true,

0 commit comments

Comments
 (0)