in benchmarks/future_benchmark.cpp [269:293]
void dispensoTaskSetTree(
dispenso::ConcurrentTaskSet& tasks,
Node* node,
Allocator& allocator,
uint32_t depth,
uint32_t bitset,
uint32_t modulo) {
node->setValue(bitset, modulo);
--depth;
if (!depth) {
node->left = nullptr;
node->right = nullptr;
return;
}
tasks.schedule([&tasks, &allocator, node, depth, bitset, modulo]() {
node->left = allocator.alloc();
dispensoTaskSetTree(tasks, node->left, allocator, depth, (bitset << 1), modulo);
});
tasks.schedule([&tasks, &allocator, node, depth, bitset, modulo]() {
node->right = allocator.alloc();
dispensoTaskSetTree(tasks, node->right, allocator, depth, (bitset << 1) | 1, modulo);
});
}