Use auto as variable type if it is initialized with a cast.
This commit is contained in:
parent
d225bdf073
commit
1e49f6dc13
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -50,10 +50,10 @@ static jint Client_nativeClientReceive(JNIEnv *env, jclass clazz, jintArray clie
|
||||
auto *manager = get_manager();
|
||||
auto response = manager->receive(timeout);
|
||||
while (response.object) {
|
||||
jint client_id = static_cast<jint>(response.client_id);
|
||||
auto client_id = static_cast<jint>(response.client_id);
|
||||
env->SetIntArrayRegion(client_ids, result_size, 1, &client_id);
|
||||
|
||||
jlong request_id = static_cast<jlong>(response.request_id);
|
||||
auto request_id = static_cast<jlong>(response.request_id);
|
||||
env->SetLongArrayRegion(ids, result_size, 1, &request_id);
|
||||
|
||||
jobject object;
|
||||
|
@ -58,7 +58,7 @@ static int fast_backtrace(void **buffer, int size) {
|
||||
void *ip;
|
||||
};
|
||||
|
||||
stack_frame *bp = reinterpret_cast<stack_frame *>(get_bp());
|
||||
auto *bp = reinterpret_cast<stack_frame *>(get_bp());
|
||||
int i = 0;
|
||||
while (i < size &&
|
||||
#if TD_LINUX
|
||||
@ -153,7 +153,7 @@ std::size_t get_ht_size() {
|
||||
|
||||
std::int32_t get_ht_pos(const Backtrace &bt, bool force = false) {
|
||||
auto hash = get_hash(bt);
|
||||
std::int32_t pos = static_cast<std::int32_t>(hash % ht.size());
|
||||
auto pos = static_cast<std::int32_t>(hash % ht.size());
|
||||
bool was_overflow = false;
|
||||
while (true) {
|
||||
auto pos_hash = ht[pos].hash.load();
|
||||
@ -237,7 +237,7 @@ static void *malloc_with_frame(std::size_t size, const Backtrace &frame) {
|
||||
}
|
||||
|
||||
static malloc_info *get_info(void *data_void) {
|
||||
char *data = static_cast<char *>(data_void);
|
||||
auto *data = static_cast<char *>(data_void);
|
||||
auto *buf = data - RESERVED_SIZE;
|
||||
|
||||
auto *info = reinterpret_cast<malloc_info *>(buf);
|
||||
|
@ -457,7 +457,7 @@ void CallActor::on_begin_exchanging_key() {
|
||||
call_state_.type = CallState::Type::ExchangingKey;
|
||||
call_state_need_flush_ = true;
|
||||
int64 call_receive_timeout_ms = G()->shared_config().get_option_integer("call_receive_timeout_ms", 20000);
|
||||
double timeout = static_cast<double>(call_receive_timeout_ms) * 0.001;
|
||||
auto timeout = static_cast<double>(call_receive_timeout_ms) * 0.001;
|
||||
LOG(INFO) << "Set call timeout to " << timeout;
|
||||
set_timeout_in(timeout);
|
||||
}
|
||||
@ -636,7 +636,7 @@ void CallActor::try_send_request_query() {
|
||||
auto query = G()->net_query_creator().create(tl_query);
|
||||
state_ = State::WaitRequestResult;
|
||||
int64 call_receive_timeout_ms = G()->shared_config().get_option_integer("call_receive_timeout_ms", 20000);
|
||||
double timeout = static_cast<double>(call_receive_timeout_ms) * 0.001;
|
||||
auto timeout = static_cast<double>(call_receive_timeout_ms) * 0.001;
|
||||
LOG(INFO) << "Set call timeout to " << timeout;
|
||||
set_timeout_in(timeout);
|
||||
query->total_timeout_limit_ = max(timeout, 10.0);
|
||||
|
@ -16389,7 +16389,7 @@ std::pair<int32, vector<DialogId>> MessagesManager::get_recently_opened_dialogs(
|
||||
|
||||
vector<DialogId> MessagesManager::sort_dialogs_by_order(const vector<DialogId> &dialog_ids, int32 limit) const {
|
||||
CHECK(!td_->auth_manager_->is_bot());
|
||||
int64 fake_order = static_cast<int64>(dialog_ids.size()) + 1;
|
||||
auto fake_order = static_cast<int64>(dialog_ids.size()) + 1;
|
||||
auto dialog_dates = transform(dialog_ids, [this, &fake_order](DialogId dialog_id) {
|
||||
const Dialog *d = get_dialog(dialog_id);
|
||||
CHECK(d != nullptr);
|
||||
|
@ -6631,7 +6631,7 @@ double StickersManager::get_emoji_language_code_last_difference_time(const strin
|
||||
return it->second;
|
||||
}
|
||||
auto &result = emoji_language_code_last_difference_times_[language_code];
|
||||
int32 old_unix_time = to_integer<int32>(G()->td_db()->get_sqlite_sync_pmc()->get(
|
||||
auto old_unix_time = to_integer<int32>(G()->td_db()->get_sqlite_sync_pmc()->get(
|
||||
get_emoji_language_code_last_difference_time_database_key(language_code)));
|
||||
int32 passed_time = max(static_cast<int32>(0), G()->unix_time() - old_unix_time);
|
||||
result = Time::now_cached() - passed_time;
|
||||
|
@ -4314,7 +4314,7 @@ class CliClient final : public Actor {
|
||||
<< stats.virtual_size_ << ", peak VSZ = " << stats.virtual_size_peak_;
|
||||
}
|
||||
} else if (op == "cpu") {
|
||||
uint32 inc_count = to_integer<uint32>(args);
|
||||
auto inc_count = to_integer<uint32>(args);
|
||||
while (inc_count-- > 0) {
|
||||
cpu_counter_++;
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ StringBuilder &operator<<(StringBuilder &sb, const Ext &ext) {
|
||||
Result<std::pair<FileFd, string>> open_temp_file(FileType file_type) {
|
||||
auto pmc = G()->td_db()->get_binlog_pmc();
|
||||
// TODO: CAS?
|
||||
int32 file_id = to_integer<int32>(pmc->get("tmp_file_id"));
|
||||
auto file_id = to_integer<int32>(pmc->get("tmp_file_id"));
|
||||
pmc->set("tmp_file_id", to_string(file_id + 1));
|
||||
|
||||
auto temp_dir = get_files_temp_dir(file_type);
|
||||
@ -94,7 +94,7 @@ bool for_suggested_file_name(CSlice name, bool use_pmc, bool use_random, F &&cal
|
||||
}
|
||||
} else if (use_pmc) {
|
||||
auto pmc = G()->td_db()->get_binlog_pmc();
|
||||
int32 file_id = to_integer<int32>(pmc->get("perm_file_id"));
|
||||
auto file_id = to_integer<int32>(pmc->get("perm_file_id"));
|
||||
pmc->set("perm_file_id", to_string(file_id + 1));
|
||||
active = callback(PSLICE() << "file_" << file_id << Ext{ext});
|
||||
if (active) {
|
||||
|
@ -298,7 +298,7 @@ void NetQueryDispatcher::try_fix_migrate(NetQueryPtr &net_query) {
|
||||
static constexpr CSlice prefixes[] = {"PHONE_MIGRATE_", "NETWORK_MIGRATE_", "USER_MIGRATE_"};
|
||||
for (auto &prefix : prefixes) {
|
||||
if (msg.substr(0, prefix.size()) == prefix) {
|
||||
int32 new_main_dc_id = to_integer<int32>(msg.substr(prefix.size()));
|
||||
auto new_main_dc_id = to_integer<int32>(msg.substr(prefix.size()));
|
||||
set_main_dc_id(new_main_dc_id);
|
||||
|
||||
if (!net_query->dc_id().is_main()) {
|
||||
|
@ -213,7 +213,7 @@ std::string fetch_string(JNIEnv *env, jobject o, jfieldID id) {
|
||||
|
||||
std::string from_jstring(JNIEnv *env, jstring s) {
|
||||
if (!s) {
|
||||
return "";
|
||||
return std::string();
|
||||
}
|
||||
jsize s_len = env->GetStringLength(s);
|
||||
const jchar *p = env->GetStringChars(s, nullptr);
|
||||
@ -264,7 +264,7 @@ std::string from_bytes(JNIEnv *env, jbyteArray arr) {
|
||||
|
||||
jbyteArray to_bytes(JNIEnv *env, const std::string &b) {
|
||||
static_assert(sizeof(char) == sizeof(jbyte), "Mismatched jbyte size");
|
||||
jsize length = narrow_cast<jsize>(b.size());
|
||||
auto length = narrow_cast<jsize>(b.size());
|
||||
jbyteArray arr = env->NewByteArray(length);
|
||||
if (arr != nullptr && length != 0) {
|
||||
env->SetByteArrayRegion(arr, 0, length, reinterpret_cast<const jbyte *>(b.data()));
|
||||
@ -274,7 +274,7 @@ jbyteArray to_bytes(JNIEnv *env, const std::string &b) {
|
||||
|
||||
jintArray store_vector(JNIEnv *env, const std::vector<std::int32_t> &v) {
|
||||
static_assert(sizeof(std::int32_t) == sizeof(jint), "Mismatched jint size");
|
||||
jsize length = narrow_cast<jsize>(v.size());
|
||||
auto length = narrow_cast<jsize>(v.size());
|
||||
jintArray arr = env->NewIntArray(length);
|
||||
if (arr != nullptr && length != 0) {
|
||||
env->SetIntArrayRegion(arr, 0, length, reinterpret_cast<const jint *>(&v[0]));
|
||||
@ -284,7 +284,7 @@ jintArray store_vector(JNIEnv *env, const std::vector<std::int32_t> &v) {
|
||||
|
||||
jlongArray store_vector(JNIEnv *env, const std::vector<std::int64_t> &v) {
|
||||
static_assert(sizeof(std::int64_t) == sizeof(jlong), "Mismatched jlong size");
|
||||
jsize length = narrow_cast<jsize>(v.size());
|
||||
auto length = narrow_cast<jsize>(v.size());
|
||||
jlongArray arr = env->NewLongArray(length);
|
||||
if (arr != nullptr && length != 0) {
|
||||
env->SetLongArrayRegion(arr, 0, length, reinterpret_cast<const jlong *>(&v[0]));
|
||||
@ -294,7 +294,7 @@ jlongArray store_vector(JNIEnv *env, const std::vector<std::int64_t> &v) {
|
||||
|
||||
jdoubleArray store_vector(JNIEnv *env, const std::vector<double> &v) {
|
||||
static_assert(sizeof(double) == sizeof(jdouble), "Mismatched jdouble size");
|
||||
jsize length = narrow_cast<jsize>(v.size());
|
||||
auto length = narrow_cast<jsize>(v.size());
|
||||
jdoubleArray arr = env->NewDoubleArray(length);
|
||||
if (arr != nullptr && length != 0) {
|
||||
env->SetDoubleArrayRegion(arr, 0, length, reinterpret_cast<const jdouble *>(&v[0]));
|
||||
@ -303,7 +303,7 @@ jdoubleArray store_vector(JNIEnv *env, const std::vector<double> &v) {
|
||||
}
|
||||
|
||||
jobjectArray store_vector(JNIEnv *env, const std::vector<std::string> &v) {
|
||||
jsize length = narrow_cast<jsize>(v.size());
|
||||
auto length = narrow_cast<jsize>(v.size());
|
||||
jobjectArray arr = env->NewObjectArray(length, StringClass, 0);
|
||||
if (arr != nullptr) {
|
||||
for (jsize i = 0; i < length; i++) {
|
||||
|
@ -107,7 +107,7 @@ jobjectArray store_vector(JNIEnv *env, const std::vector<std::string> &v);
|
||||
|
||||
template <class T>
|
||||
jobjectArray store_vector(JNIEnv *env, const std::vector<T> &v) {
|
||||
jint length = static_cast<jint>(v.size());
|
||||
auto length = static_cast<jint>(v.size());
|
||||
jobjectArray arr = env->NewObjectArray(length, T::element_type::Class, jobject());
|
||||
if (arr != nullptr) {
|
||||
for (jint i = 0; i < length; i++) {
|
||||
@ -155,7 +155,7 @@ class get_array_class<td_api::pageBlockTableCell> {
|
||||
|
||||
template <class T>
|
||||
jobjectArray store_vector(JNIEnv *env, const std::vector<std::vector<T>> &v) {
|
||||
jint length = static_cast<jint>(v.size());
|
||||
auto length = static_cast<jint>(v.size());
|
||||
jobjectArray arr = env->NewObjectArray(length, get_array_class<typename T::element_type>::get(), 0);
|
||||
if (arr != nullptr) {
|
||||
for (jint i = 0; i < length; i++) {
|
||||
|
@ -435,7 +435,7 @@ void Scheduler::set_actor_timeout_at(ActorInfo *actor_info, double timeout_at) {
|
||||
|
||||
void Scheduler::run_poll(Timestamp timeout) {
|
||||
// we can't wait for less than 1ms
|
||||
int timeout_ms = static_cast<int32>(clamp(timeout.in(), 0.0, 1000000.0) * 1000 + 1);
|
||||
auto timeout_ms = static_cast<int>(clamp(timeout.in(), 0.0, 1000000.0) * 1000 + 1);
|
||||
#if TD_PORT_WINDOWS
|
||||
CHECK(inbound_queue_);
|
||||
inbound_queue_->reader_get_event_fd().wait(timeout_ms);
|
||||
|
@ -680,7 +680,7 @@ void Binlog::do_reindex() {
|
||||
<< detail::file_size(new_path) << ' ' << fd_events_ << ' ' << path_;
|
||||
}
|
||||
|
||||
double ratio = static_cast<double>(start_size) / static_cast<double>(finish_size + 1);
|
||||
auto ratio = static_cast<double>(start_size) / static_cast<double>(finish_size + 1);
|
||||
|
||||
[&](Slice msg) {
|
||||
if (start_size > (10 << 20) || finish_time - start_time > 1) {
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "td/utils/port/path.h"
|
||||
#include "td/utils/SliceBuilder.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstring>
|
||||
|
||||
namespace td {
|
||||
@ -114,14 +115,14 @@ Result<size_t> HttpReader::read_next(HttpQuery *query, bool can_be_slow) {
|
||||
return Status::Error(400, "Bad Request: boundary not found");
|
||||
}
|
||||
p += 8;
|
||||
ptrdiff_t offset = p - content_type_lowercased_.c_str();
|
||||
std::ptrdiff_t offset = p - content_type_lowercased_.c_str();
|
||||
p = static_cast<const char *>(
|
||||
std::memchr(content_type_.begin() + offset, '=', content_type_.size() - offset));
|
||||
if (p == nullptr) {
|
||||
return Status::Error(400, "Bad Request: boundary value not found");
|
||||
}
|
||||
p++;
|
||||
const char *end_p = static_cast<const char *>(std::memchr(p, ';', content_type_.end() - p));
|
||||
auto end_p = static_cast<const char *>(std::memchr(p, ';', content_type_.end() - p));
|
||||
if (end_p == nullptr) {
|
||||
end_p = content_type_.end();
|
||||
}
|
||||
|
@ -486,7 +486,7 @@ int strm_read(BIO *b, char *buf, int len) {
|
||||
CHECK(stream != nullptr);
|
||||
BIO_clear_retry_flags(b);
|
||||
CHECK(buf != nullptr);
|
||||
int res = narrow_cast<int>(stream->flow_read(MutableSlice(buf, len)));
|
||||
auto res = narrow_cast<int>(stream->flow_read(MutableSlice(buf, len)));
|
||||
if (res == 0) {
|
||||
BIO_set_retry_read(b);
|
||||
return -1;
|
||||
|
@ -57,8 +57,8 @@ class AtomicHashArray {
|
||||
template <class F>
|
||||
bool with_value(KeyT key, bool should_create, F &&f) {
|
||||
DCHECK(key != empty_key());
|
||||
size_t pos = static_cast<size_t>(key) % nodes_.size();
|
||||
size_t n = td::min(td::max(static_cast<size_t>(300), nodes_.size() / 16 + 2), nodes_.size());
|
||||
auto pos = static_cast<size_t>(key) % nodes_.size();
|
||||
auto n = td::min(td::max(static_cast<size_t>(300), nodes_.size() / 16 + 2), nodes_.size());
|
||||
|
||||
for (size_t i = 0; i < n; i++) {
|
||||
pos++;
|
||||
|
@ -47,8 +47,8 @@ class MemoryLog final : public LogInterface {
|
||||
CHECK(slice_size * 3 < buffer_size);
|
||||
size_t pad_size = ((slice_size + 15) & ~15) - slice_size;
|
||||
constexpr size_t MAGIC_SIZE = 16;
|
||||
uint32 total_size = static_cast<uint32>(slice_size + pad_size + MAGIC_SIZE);
|
||||
uint32 real_pos = pos_.fetch_add(total_size, std::memory_order_relaxed);
|
||||
auto total_size = static_cast<uint32>(slice_size + pad_size + MAGIC_SIZE);
|
||||
auto real_pos = pos_.fetch_add(total_size, std::memory_order_relaxed);
|
||||
CHECK((total_size & 15) == 0);
|
||||
|
||||
uint32 start_pos = real_pos & (buffer_size - 1);
|
||||
|
@ -77,7 +77,7 @@ class StealingQueue {
|
||||
if (other_tail < other_head) {
|
||||
continue;
|
||||
}
|
||||
size_t n = narrow_cast<size_t>(other_tail - other_head);
|
||||
auto n = narrow_cast<size_t>(other_tail - other_head);
|
||||
if (n > N) {
|
||||
continue;
|
||||
}
|
||||
|
@ -191,7 +191,7 @@ StringBuilder &StringBuilder::operator<<(FixedDouble x) {
|
||||
ss->precision(x.precision);
|
||||
*ss << x.d;
|
||||
|
||||
int len = narrow_cast<int>(static_cast<std::streamoff>(ss->tellp()));
|
||||
auto len = narrow_cast<int>(static_cast<std::streamoff>(ss->tellp()));
|
||||
auto left = end_ptr_ + RESERVED_SIZE - current_ptr_;
|
||||
if (unlikely(len >= left)) {
|
||||
error_flag_ = true;
|
||||
|
@ -466,7 +466,7 @@ class AesIgeStateImpl {
|
||||
}
|
||||
|
||||
evp_.init_iv(encrypted_iv_.as_slice());
|
||||
int inlen = static_cast<int>(AES_BLOCK_SIZE * count);
|
||||
auto inlen = static_cast<int>(AES_BLOCK_SIZE * count);
|
||||
evp_.encrypt(data_xored[0].raw(), data_xored[0].raw(), inlen);
|
||||
|
||||
data_xored[0] ^= plaintext_iv_;
|
||||
@ -850,7 +850,7 @@ static void pbkdf2_impl(Slice password, Slice salt, int iteration_count, Mutable
|
||||
HMAC_CTX ctx;
|
||||
HMAC_CTX_init(&ctx);
|
||||
unsigned char counter[4] = {0, 0, 0, 1};
|
||||
int password_len = narrow_cast<int>(password.size());
|
||||
auto password_len = narrow_cast<int>(password.size());
|
||||
HMAC_Init_ex(&ctx, password.data(), password_len, evp_md, nullptr);
|
||||
HMAC_Update(&ctx, salt.ubegin(), narrow_cast<int>(salt.size()));
|
||||
HMAC_Update(&ctx, counter, 4);
|
||||
|
@ -33,7 +33,7 @@ bool find_boundary(ChainBufferReader range, Slice boundary, size_t &already_read
|
||||
range.advance(1);
|
||||
already_read++;
|
||||
} else {
|
||||
const char *ptr = static_cast<const char *>(std::memchr(ready.data(), boundary[0], ready.size()));
|
||||
const auto *ptr = static_cast<const char *>(std::memchr(ready.data(), boundary[0], ready.size()));
|
||||
size_t shift;
|
||||
if (ptr == nullptr) {
|
||||
shift = ready.size();
|
||||
|
@ -86,7 +86,7 @@ static void punycode(string &result, Slice part) {
|
||||
|
||||
if (code == next_n) {
|
||||
// found next symbol, encode delta
|
||||
int left = static_cast<int>(delta);
|
||||
auto left = static_cast<int>(delta);
|
||||
while (true) {
|
||||
bias += 36;
|
||||
auto t = clamp(bias, 1, 26);
|
||||
|
@ -178,7 +178,7 @@ class TlParser {
|
||||
if (!error.empty()) {
|
||||
return T();
|
||||
}
|
||||
const char *result = reinterpret_cast<const char *>(data);
|
||||
auto result = reinterpret_cast<const char *>(data);
|
||||
data += size;
|
||||
return T(result, size);
|
||||
}
|
||||
|
@ -131,9 +131,9 @@ TEST(StealingQueue, simple) {
|
||||
for (td::uint64 round = 1; round < 1000; round++) {
|
||||
if (id == 0) {
|
||||
sum = 0;
|
||||
int n = static_cast<int>(rnd() % 5);
|
||||
auto n = static_cast<int>(rnd() % 5);
|
||||
for (int j = 0; j < n; j++) {
|
||||
int x = static_cast<int>(rnd() % XN);
|
||||
auto x = static_cast<int>(rnd() % XN);
|
||||
sum += x_sum[x];
|
||||
gq.push(x, id);
|
||||
}
|
||||
|
@ -78,8 +78,8 @@ class RangeSet {
|
||||
|
||||
CHECK(it.begin % BIT_SIZE == 0);
|
||||
CHECK(it.end % BIT_SIZE == 0);
|
||||
uint32 begin = narrow_cast<uint32>(it.begin / BIT_SIZE);
|
||||
uint32 end = narrow_cast<uint32>(it.end / BIT_SIZE);
|
||||
auto begin = narrow_cast<uint32>(it.begin / BIT_SIZE);
|
||||
auto end = narrow_cast<uint32>(it.end / BIT_SIZE);
|
||||
if (sizes.empty()) {
|
||||
if (begin != 0) {
|
||||
sizes.push_back(0);
|
||||
|
Loading…
Reference in New Issue
Block a user