Skip to content

Commit 82de754

Browse files
authored
Merge pull request #1605 from evoskuil/master
Integrate POOLSTL_STD_SUPPLEMENT.
2 parents 4426565 + 3cf8e81 commit 82de754

File tree

6 files changed

+13
-44
lines changed

6 files changed

+13
-44
lines changed

include/bitcoin/system/define.hpp

-12
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,4 @@ namespace bc = libbitcoin;
7979
namespace libbitcoin { constexpr auto with_arm = false; };
8080
#endif
8181

82-
/// Workarounds for C++ noncompliance.
83-
/// ---------------------------------------------------------------------------
84-
85-
/// C++17 (partial), see HAVE_EXECUTION.
86-
#if defined(HAVE_EXECUTION)
87-
namespace libbitcoin { constexpr auto par_unseq = std::execution::par_unseq; }
88-
namespace libbitcoin { constexpr auto seq = std::execution::seq; }
89-
#else
90-
namespace libbitcoin { constexpr auto par_unseq = false; }
91-
namespace libbitcoin { constexpr auto seq = false; }
92-
#endif
93-
9482
#endif

include/bitcoin/system/have.hpp

-10
Original file line numberDiff line numberDiff line change
@@ -204,16 +204,6 @@
204204
#endif
205205
#endif
206206

207-
/// None on xcode.
208-
/// Requires link with -ltbb on gcc (v9).
209-
/// Experimental on clang (libcxx.llvm.org/Status/PSTL.html), requires:
210-
/// -fexperimental-library
211-
#if defined(HAVE_CPP17)
212-
#if defined(HAVE_MSC)
213-
#define HAVE_EXECUTION
214-
#endif
215-
#endif
216-
217207
/// These are manually configured here.
218208
/// ---------------------------------------------------------------------------
219209

include/bitcoin/system/impl/hash/scrypt.ipp

+3-3
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ CONSTEVAL auto& CLASS::
4545
concurrency() NOEXCEPT
4646
{
4747
if constexpr (Concurrent)
48-
return bc::par_unseq;
48+
return poolstl::execution::par;
4949
else
50-
return bc::seq;
50+
return poolstl::execution::seq;
5151
}
5252

5353
// protected
@@ -499,7 +499,7 @@ CLASS::hash(data_array<Size>& out, const data_slice& password,
499499
// B[i] = scryptROMix (r, B[i], N)
500500
// end for
501501
std::atomic_bool success{ true };
502-
std_for_each(concurrency(), prblocks.begin(), prblocks.end(),
502+
std::for_each(concurrency(), prblocks.begin(), prblocks.end(),
503503
[&](rblock_t& rblock) NOEXCEPT
504504
{
505505
success = success && romix(rblock);

include/bitcoin/system/preprocessor.hpp

+6-15
Original file line numberDiff line numberDiff line change
@@ -212,21 +212,12 @@
212212
#define FALLTHROUGH [[fallthrough]]
213213

214214
/// C++17 (partial)
215-
#if defined(HAVE_EXECUTION)
216-
#include <execution>
217-
#define std_any_of(p, b, e, l) std::any_of((p), (b), (e), (l))
218-
#define std_all_of(p, b, e, l) std::all_of((p), (b), (e), (l))
219-
#define std_for_each(p, b, e, l) std::for_each((p), (b), (e), (l))
220-
#define std_reduce(p, b, e, i, l) std::reduce((p), (b), (e), (i), (l))
221-
#define std_transform(p, b, e, t, l) std::transform((p), (b), (e), (t), (l))
222-
#else
223-
#include <bitcoin/system/execution.hpp>
224-
#define std_any_of(p, b, e, l) std::any_of((b), (e), (l))
225-
#define std_all_of(p, b, e, l) std::all_of((b), (e), (l))
226-
#define std_for_each(p, b, e, l) std::for_each((b), (e), (l))
227-
#define std_reduce(p, b, e, i, l) std::reduce((b), (e), (i), (l))
228-
#define std_transform(p, b, e, t, l) std::transform((b), (e), (t), (l))
229-
#endif
215+
/// None on xcode.
216+
/// Requires link with -ltbb on gcc (v9).
217+
/// Experimental on clang (libcxx.llvm.org/Status/PSTL.html), requires:
218+
/// -fexperimental-library
219+
/// using poolstl, do not include <execution>.
220+
#include <bitcoin/system/execution.hpp>
230221

231222
/// C++20 (partial)
232223
#if defined(HAVE_CONSTEVAL)

test/hacks.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#include "test.hpp"
2020
#include <utility>
2121

22-
#if defined(DISABLED) && defined(HAVE_EXECUTION)
22+
#if defined(DISABLED)
2323

2424
BOOST_AUTO_TEST_SUITE(skip_parser_tests)
2525

@@ -274,7 +274,7 @@ BOOST_AUTO_TEST_CASE(skip_parser__skip_parse_concurrent_tx__factor__expected)
274274

275275
for (size_t i = 0; i < factor; ++i)
276276
{
277-
std::for_each(std::execution::par_unseq, jobs.begin(), jobs.end(),
277+
std::for_each(poolstl::execution::par, jobs.begin(), jobs.end(),
278278
[&](const auto job)
279279
{
280280
if (job)
@@ -299,7 +299,7 @@ BOOST_AUTO_TEST_CASE(skip_parser__skip_parse_concurrent_block__factor_txs__expec
299299
const auto expected1 = bitcoin_hash(tx_2);
300300
constexpr std_array<bool, factor> jobs{};
301301

302-
std::for_each(std::execution::par_unseq, jobs.begin(), jobs.end(),
302+
std::for_each(poolstl::execution::par, jobs.begin(), jobs.end(),
303303
[&](const auto)
304304
{
305305
stream::in::copy input(tx_2);

test/hash/hash.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ const auto sha_5 = data_chunk(1'000'000_size, to_byte('a'));
290290
constexpr auto alpha_count = 16'777'216_size;
291291
constexpr auto long_alpha_size = alpha_size * alpha_count;
292292
const auto alpha2 = to_array<alpha_size>("abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmno");
293-
const std_vector<long_hash> long_alpha(alpha2_count, alpha2);
293+
const std_vector<long_hash> long_alpha(alpha_count, alpha2);
294294
const auto long_alpha_data = pointer_cast<const uint8_t>(long_alpha.front().data());
295295
const auto sha_6 = to_chunk(unsafe_array_cast<uint8_t, long_alpha_size>(long_alpha_data));
296296
#endif // !HAVE_SLOW_TESTS

0 commit comments

Comments
 (0)