[ORC] Add std::tuple support to SimplePackedSerialization.
[llvm-project.git] / llvm / utils / benchmark / src / benchmark_register.h
blob4caa5ad4da0796da5d5d319a4eaec8c5968b797e
1 #ifndef BENCHMARK_REGISTER_H
2 #define BENCHMARK_REGISTER_H
4 #include <limits>
5 #include <vector>
7 #include "check.h"
9 template <typename T>
10 void AddRange(std::vector<T>* dst, T lo, T hi, int mult) {
11 CHECK_GE(lo, 0);
12 CHECK_GE(hi, lo);
13 CHECK_GE(mult, 2);
15 // Add "lo"
16 dst->push_back(lo);
18 static const T kmax = std::numeric_limits<T>::max();
20 // Now space out the benchmarks in multiples of "mult"
21 for (T i = 1; i < kmax / mult; i *= mult) {
22 if (i >= hi) break;
23 if (i > lo) {
24 dst->push_back(i);
28 // Add "hi" (if different from "lo")
29 if (hi != lo) {
30 dst->push_back(hi);
34 #endif // BENCHMARK_REGISTER_H