1
0
mirror of https://github.com/exaloop/codon.git synced 2025-06-03 15:03:52 +08:00

added anonymous namespace and ran clang format

This commit is contained in:
Stephen Berry 2022-12-16 10:18:01 -06:00
parent 27c4ba3a0e
commit 3d60f30a23

View File

@ -5,34 +5,35 @@
#include <utility>
#include <vector>
struct Node {
namespace {
struct Node {
std::unique_ptr<Node> left{};
std::unique_ptr<Node> right{};
};
};
inline std::unique_ptr<Node> make_tree(int d) {
inline std::unique_ptr<Node> make_tree(int d) {
if (d > 0) {
return std::make_unique<Node>(Node{make_tree(d - 1), make_tree(d - 1)});
}
else {
return std::make_unique<Node>();
}
}
}
inline int check_tree(const std::unique_ptr<Node>& node) {
inline int check_tree(const std::unique_ptr<Node>& node) {
if (!node->left)
return 1;
else
return 1 + check_tree(node->left) + check_tree(node->right);
}
}
inline int make_check(const std::pair<int, int> &itde) {
inline int make_check(const std::pair<int, int> &itde) {
int i = itde.first, d = itde.second;
auto tree = make_tree(d);
return check_tree(tree);
}
}
struct ArgChunks {
struct ArgChunks {
int i, k, d, chunksize;
std::vector<std::pair<int, int>> chunk;
@ -50,7 +51,8 @@ struct ArgChunks {
}
return !chunk.empty();
}
};
};
} // namespace
int main(int argc, char *argv[]) {
using clock = std::chrono::high_resolution_clock;