File size: 592 Bytes
8b7c501
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <benchmark/benchmark.h>

#include <fxdiv.h>

static void init_uint32_t(benchmark::State& state) {
	uint32_t d = UINT32_C(0x1971DB6B);
	while (state.KeepRunning()) {
		const fxdiv_divisor_uint32_t divisor = fxdiv_init_uint32_t(d++);
		benchmark::DoNotOptimize(divisor);
	}
}
BENCHMARK(init_uint32_t);

static void init_uint64_t(benchmark::State& state) {
	uint64_t d = UINT64_C(0x425E892B38148FAD);
	while (state.KeepRunning()) {
		const fxdiv_divisor_uint64_t divisor = fxdiv_init_uint64_t(d++);
		benchmark::DoNotOptimize(divisor);
	}
}
BENCHMARK(init_uint64_t);

BENCHMARK_MAIN();