Skip to content

Commit

Permalink
Fixed macro formatting using do { } while (false).
Browse files Browse the repository at this point in the history
  • Loading branch information
tfpf committed Apr 22, 2024
1 parent b31c912 commit edc67ce
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions benchmarks/benchmarks.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <hdrbg.h>

#define benchmark(function, iterations) \
do \
{ \
auto delay = std::chrono::microseconds::max(); \
for (int i = 0; i < 32; ++i) \
Expand All @@ -19,13 +20,16 @@
} \
auto result = delay.count() / static_cast<double>(iterations); \
std::printf("%20s %8.2lf µs\n", #function, result); \
}
} while (false)

/******************************************************************************
* Main function.
*****************************************************************************/
int
main(void)
{
benchmark(hdrbg_init, 100) benchmark(hdrbg_reinit, 100) benchmark(hdrbg_rand, 800) benchmark(hdrbg_real, 800)
benchmark(hdrbg_init, 100);
benchmark(hdrbg_reinit, 100);
benchmark(hdrbg_rand, 800);
benchmark(hdrbg_real, 800);
}

0 comments on commit edc67ce

Please sign in to comment.