Fix error Wshorten-64-to-32 (#1273)

Signed-off-by: Bensuperpc <bensuperpc@gmail.com>
This commit is contained in:
Bensuperpc 2021-11-04 11:26:11 +01:00 committed by GitHub
parent 8aae0a4f67
commit 8826ef792f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 12 deletions

View File

@ -13,7 +13,7 @@ BENCHMARK(BM_empty)->ThreadPerCpu();
void BM_spin_empty(benchmark::State& state) { void BM_spin_empty(benchmark::State& state) {
for (auto _ : state) { for (auto _ : state) {
for (int x = 0; x < state.range(0); ++x) { for (auto x = 0; x < state.range(0); ++x) {
benchmark::DoNotOptimize(x); benchmark::DoNotOptimize(x);
} }
} }
@ -22,11 +22,11 @@ BASIC_BENCHMARK_TEST(BM_spin_empty);
BASIC_BENCHMARK_TEST(BM_spin_empty)->ThreadPerCpu(); BASIC_BENCHMARK_TEST(BM_spin_empty)->ThreadPerCpu();
void BM_spin_pause_before(benchmark::State& state) { void BM_spin_pause_before(benchmark::State& state) {
for (int i = 0; i < state.range(0); ++i) { for (auto i = 0; i < state.range(0); ++i) {
benchmark::DoNotOptimize(i); benchmark::DoNotOptimize(i);
} }
for (auto _ : state) { for (auto _ : state) {
for (int i = 0; i < state.range(0); ++i) { for (auto i = 0; i < state.range(0); ++i) {
benchmark::DoNotOptimize(i); benchmark::DoNotOptimize(i);
} }
} }
@ -37,11 +37,11 @@ BASIC_BENCHMARK_TEST(BM_spin_pause_before)->ThreadPerCpu();
void BM_spin_pause_during(benchmark::State& state) { void BM_spin_pause_during(benchmark::State& state) {
for (auto _ : state) { for (auto _ : state) {
state.PauseTiming(); state.PauseTiming();
for (int i = 0; i < state.range(0); ++i) { for (auto i = 0; i < state.range(0); ++i) {
benchmark::DoNotOptimize(i); benchmark::DoNotOptimize(i);
} }
state.ResumeTiming(); state.ResumeTiming();
for (int i = 0; i < state.range(0); ++i) { for (auto i = 0; i < state.range(0); ++i) {
benchmark::DoNotOptimize(i); benchmark::DoNotOptimize(i);
} }
} }
@ -62,11 +62,11 @@ BENCHMARK(BM_pause_during)->UseRealTime()->ThreadPerCpu();
void BM_spin_pause_after(benchmark::State& state) { void BM_spin_pause_after(benchmark::State& state) {
for (auto _ : state) { for (auto _ : state) {
for (int i = 0; i < state.range(0); ++i) { for (auto i = 0; i < state.range(0); ++i) {
benchmark::DoNotOptimize(i); benchmark::DoNotOptimize(i);
} }
} }
for (int i = 0; i < state.range(0); ++i) { for (auto i = 0; i < state.range(0); ++i) {
benchmark::DoNotOptimize(i); benchmark::DoNotOptimize(i);
} }
} }
@ -74,15 +74,15 @@ BASIC_BENCHMARK_TEST(BM_spin_pause_after);
BASIC_BENCHMARK_TEST(BM_spin_pause_after)->ThreadPerCpu(); BASIC_BENCHMARK_TEST(BM_spin_pause_after)->ThreadPerCpu();
void BM_spin_pause_before_and_after(benchmark::State& state) { void BM_spin_pause_before_and_after(benchmark::State& state) {
for (int i = 0; i < state.range(0); ++i) { for (auto i = 0; i < state.range(0); ++i) {
benchmark::DoNotOptimize(i); benchmark::DoNotOptimize(i);
} }
for (auto _ : state) { for (auto _ : state) {
for (int i = 0; i < state.range(0); ++i) { for (auto i = 0; i < state.range(0); ++i) {
benchmark::DoNotOptimize(i); benchmark::DoNotOptimize(i);
} }
} }
for (int i = 0; i < state.range(0); ++i) { for (auto i = 0; i < state.range(0); ++i) {
benchmark::DoNotOptimize(i); benchmark::DoNotOptimize(i);
} }
} }
@ -145,7 +145,7 @@ BENCHMARK(BM_RangedFor);
#ifdef BENCHMARK_HAS_CXX11 #ifdef BENCHMARK_HAS_CXX11
template <typename T> template <typename T>
void BM_OneTemplateFunc(benchmark::State& state) { void BM_OneTemplateFunc(benchmark::State& state) {
int arg = state.range(0); auto arg = state.range(0);
T sum = 0; T sum = 0;
for (auto _ : state) { for (auto _ : state) {
sum += arg; sum += arg;
@ -156,7 +156,7 @@ BENCHMARK(BM_OneTemplateFunc<double>)->Arg(1);
template <typename A, typename B> template <typename A, typename B>
void BM_TwoTemplateFunc(benchmark::State& state) { void BM_TwoTemplateFunc(benchmark::State& state) {
int arg = state.range(0); auto arg = state.range(0);
A sum = 0; A sum = 0;
B prod = 1; B prod = 1;
for (auto _ : state) { for (auto _ : state) {