diff options
| author | levlam <levlam@telegram.org> | 2021-10-20 01:27:02 +0300 |
|---|---|---|
| committer | levlam <levlam@telegram.org> | 2021-10-20 01:27:02 +0300 |
| commit | 1e49f6dc13d6cad09f80c8e5a194ccea422f42cc (patch) | |
| tree | bf957c39bb2fbdf8b887ee2f4ccfd4ecc232e11d /benchmark | |
| parent | d225bdf073c68d42536d42e46ddf8648538555b9 (diff) | |
Use auto as variable type if it is initialized with a cast.
Diffstat (limited to 'benchmark')
| -rw-r--r-- | benchmark/bench_http_reader.cpp | 6 | ||||
| -rw-r--r-- | benchmark/bench_queue.cpp | 10 |
2 files changed, 8 insertions, 8 deletions
diff --git a/benchmark/bench_http_reader.cpp b/benchmark/bench_http_reader.cpp index a37c9718c..3babb748a 100644 --- a/benchmark/bench_http_reader.cpp +++ b/benchmark/bench_http_reader.cpp @@ -22,7 +22,7 @@ class HttpReaderBench final : public td::Benchmark { } void run(int n) final { - int cnt = static_cast<int>(block_size / http_query.size()); + auto cnt = static_cast<int>(block_size / http_query.size()); td::HttpQuery q; int parsed = 0; int sent = 0; @@ -58,7 +58,7 @@ class BufferBench final : public td::Benchmark { } void run(int n) final { - int cnt = static_cast<int>(block_size / http_query.size()); + auto cnt = static_cast<int>(block_size / http_query.size()); for (int i = 0; i < n; i += cnt) { for (int j = 0; j < cnt; j++) { writer_.append(http_query); @@ -84,7 +84,7 @@ class FindBoundaryBench final : public td::Benchmark { } void run(int n) final { - int cnt = static_cast<int>(block_size / http_query.size()); + auto cnt = static_cast<int>(block_size / http_query.size()); for (int i = 0; i < n; i += cnt) { for (int j = 0; j < cnt; j++) { writer_.append(http_query); diff --git a/benchmark/bench_queue.cpp b/benchmark/bench_queue.cpp index a442cfb26..f9a724fd3 100644 --- a/benchmark/bench_queue.cpp +++ b/benchmark/bench_queue.cpp @@ -591,7 +591,7 @@ class QueueBenchmark2 final : public td::Benchmark { void server_process(qvalue_t value) { int no = value & 0x00FFFFFF; - int co = static_cast<int>(static_cast<td::uint32>(value) >> 24); + auto co = static_cast<int>(static_cast<td::uint32>(value) >> 24); // std::fprintf(stderr, "-->%d %d\n", co, no); if (co < 0 || co >= connections_n || no != server_conn[co]++) { std::fprintf(stderr, "%d %d\n", co, no); @@ -632,7 +632,7 @@ class QueueBenchmark2 final : public td::Benchmark { void client_process(qvalue_t value) { int no = value & 0x00FFFFFF; - int co = static_cast<int>(static_cast<td::uint32>(value) >> 24); + auto co = static_cast<int>(static_cast<td::uint32>(value) >> 24); // std::fprintf(stderr, "<--%d %d\n", co, no); if (co < 0 || co >= connections_n || no != client_conn[co]++) { std::fprintf(stderr, "%d %d\n", co, no); @@ -733,7 +733,7 @@ class QueueBenchmark final : public td::Benchmark { while (active_connections > 0) { qvalue_t value = server.get(); int no = value & 0x00FFFFFF; - int co = static_cast<int>(value >> 24); + auto co = static_cast<int>(value >> 24); // std::fprintf(stderr, "-->%d %d\n", co, no); if (co < 0 || co >= connections_n || no != conn[co]++) { std::fprintf(stderr, "%d %d\n", co, no); @@ -764,7 +764,7 @@ class QueueBenchmark final : public td::Benchmark { while (active_connections > 0) { qvalue_t value = client.get(); int no = value & 0x00FFFFFF; - int co = static_cast<int>(value >> 24); + auto co = static_cast<int>(value >> 24); // std::fprintf(stderr, "<--%d %d\n", co, no); if (co < 0 || co >= connections_n || no != conn[co]++) { std::fprintf(stderr, "%d %d\n", co, no); @@ -797,7 +797,7 @@ class QueueBenchmark final : public td::Benchmark { for (int i = 0; i < connections_n; i++) { qvalue_t value = client.get(); int no = value & 0x00FFFFFF; - int co = static_cast<int>(value >> 24); + auto co = static_cast<int>(value >> 24); // std::fprintf(stderr, "<--%d %d\n", co, no); if (co < 0 || co >= connections_n || no != conn[co]++) { std::fprintf(stderr, "%d %d\n", co, no); |
