mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
committed by
Rasmus Munk Larsen
parent
8ae3b1aaa5
commit
1133aa82c7
@@ -30,12 +30,10 @@ EIGEN_DONT_INLINE Scalar check_in_range(Scalar x, Scalar y) {
|
||||
template <typename Scalar>
|
||||
void check_all_in_range(Scalar x, Scalar y) {
|
||||
constexpr int repeats = 32;
|
||||
uint64_t count = static_cast<uint64_t>(y) - static_cast<uint64_t>(x) + 1;
|
||||
Index count = static_cast<Index>(y) - static_cast<Index>(x) + 1;
|
||||
ArrayX<bool> mask(count);
|
||||
// ensure that `count` does not overflow the return type of `mask.size()`
|
||||
VERIFY(count == static_cast<uint64_t>(mask.size()));
|
||||
mask.setConstant(false);
|
||||
for (uint64_t k = 0; k < count; k++)
|
||||
for (Index k = 0; k < count; k++)
|
||||
for (int repeat = 0; repeat < repeats; repeat++) {
|
||||
Scalar r = check_in_range(x, y);
|
||||
Index i = static_cast<Index>(r) - static_cast<Index>(x);
|
||||
|
||||
@@ -26,7 +26,7 @@ static void test_parallel_for(int granularity) {
|
||||
TestData test_data = make_test_data(/*num_threads=*/4, kNumTasks);
|
||||
std::atomic<uint64_t> sum(0);
|
||||
std::function<void(Index, Index)> binary_do_fn = [&](Index i, Index j) {
|
||||
for (int k = i; k < j; ++k)
|
||||
for (Index k = i; k < j; ++k)
|
||||
for (uint64_t new_sum = sum; !sum.compare_exchange_weak(new_sum, new_sum + test_data.data[k]);) {
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user