Skip to content

Commit 4aa5e8b

Browse files
committed
use for each syntax
1 parent 945090f commit 4aa5e8b

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

libc/benchmarks/gpu/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ add_unittest_framework_library(
4747
libc.src.__support.macros.properties.types
4848
libc.src.__support.OSUtil.osutil
4949
libc.src.__support.uint128
50-
libc.src.___support.FPUtil.sqrt
50+
libc.src.__support.FPUtil.sqrt
5151
libc.src.__support.fixedvector
5252
libc.src.time.clock
5353
libc.benchmarks.gpu.timing.timing

libc/benchmarks/gpu/LibcGpuBenchmark.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,11 @@ void Benchmark::run_benchmarks() {
5151
uint64_t id = gpu::get_thread_id();
5252
gpu::sync_threads();
5353

54-
for (auto it = benchmarks.rbegin(), e = benchmarks.rend(); it != e; ++it) {
55-
Benchmark *benchmark = *it;
54+
for (Benchmark *benchmark : benchmarks)
5655
results[id] = benchmark->run();
57-
}
5856
gpu::sync_threads();
5957
if (id == 0) {
60-
for (auto it = benchmarks.rbegin(), e = benchmarks.rend(); it != e; ++it) {
61-
Benchmark *benchmark = *it;
58+
for (Benchmark *benchmark : benchmarks) {
6259
BenchmarkResult all_results = reduce_results(results);
6360
constexpr auto GREEN = "\033[32m";
6461
constexpr auto RESET = "\033[0m";
@@ -128,9 +125,9 @@ BenchmarkResult benchmark(const BenchmarkOptions &options,
128125
iterations *= options.scaling_factor;
129126
}
130127
result.cycles = best_guess;
131-
result.standard_deviation =
132-
fputil::sqrt(static_cast<double>(cycles_squared) / total_iterations -
133-
(best_guess * best_guess));
128+
result.standard_deviation = fputil::sqrt<double>(
129+
static_cast<double>(cycles_squared) / total_iterations -
130+
static_cast<double>(best_guess * best_guess));
134131
result.min = min;
135132
result.max = max;
136133
result.samples = samples;

0 commit comments

Comments
 (0)