diff --git a/libpandabase/utils/bit_utils.h b/libpandabase/utils/bit_utils.h index e36451d61e7b23011ec0dee509cb385a64979e74..5ef88a7385f5c67a21e75063a465dd8921c25ef7 100644 --- a/libpandabase/utils/bit_utils.h +++ b/libpandabase/utils/bit_utils.h @@ -137,7 +137,7 @@ template constexpr T RoundUp(T x, size_t n) { static_assert(std::is_integral::value, "T must be integral"); - return (x + n - 1) & static_cast(-n); + return static_cast(x + n - 1) & (-n); } constexpr size_t BitsToBytesRoundUp(size_t num_bits) diff --git a/libpandafile/line_number_program.h b/libpandafile/line_number_program.h index 36504b088158178fd1d42e2a71a39c8ebec33de9..1e93d1bbb56a02ad9bacf92c3c8509532e12b121 100644 --- a/libpandafile/line_number_program.h +++ b/libpandafile/line_number_program.h @@ -30,7 +30,7 @@ public: void AdvanceLine(int32_t v) { - line_ += v; + line_ += static_cast(v); } void AdvancePc(uint32_t v) @@ -75,7 +75,7 @@ public: void SetColumn(int32_t c) { - column_ = c; + column_ = static_cast(c); } size_t GetColumn() const @@ -273,10 +273,10 @@ private: bool HandleSpecialOpcode(LineNumberProgramItem::Opcode opcode) { - ASSERT(static_cast(opcode) >= LineNumberProgramItem::OPCODE_BASE); + ASSERT(opcode >= LineNumberProgramItem::OPCODE_BASE); - auto adjust_opcode = static_cast(opcode) - LineNumberProgramItem::OPCODE_BASE; - uint32_t pc_offset = adjust_opcode / LineNumberProgramItem::LINE_RANGE; + auto adjust_opcode = static_cast(opcode - const_cast(LineNumberProgramItem::OPCODE_BASE)); + auto pc_offset = static_cast(adjust_opcode / LineNumberProgramItem::LINE_RANGE); int32_t line_offset = adjust_opcode % LineNumberProgramItem::LINE_RANGE + LineNumberProgramItem::LINE_BASE; return handler_->HandleSpecialOpcode(pc_offset, line_offset); } diff --git a/runtime/asm_defines/asm_defines.def b/runtime/asm_defines/asm_defines.def index 2368c87e1d32a05a9cf65a9ca21f1cf8b6b673f0..8710c1bddd7cb1c37c0d10cb343b6a9ec1d5501a 100644 --- a/runtime/asm_defines/asm_defines.def +++ b/runtime/asm_defines/asm_defines.def @@ -51,7 +51,7 @@ DEFINE_VALUE(CALLEE_SAVED_SIZE, (GetCalleeRegsCount(RUNTIME_ARCH, false) + GetCa PointerSize(RUNTIME_ARCH)) DEFINE_VALUE(BRIDGE_FRAME_SIZE, AlignUp( - (CFrameFlags::End() + GetCalleeRegsCount(RUNTIME_ARCH, false) + GetCalleeRegsCount(RUNTIME_ARCH, true)) * + (CFrameFlags::End() + static_cast(GetCalleeRegsCount(RUNTIME_ARCH, false) + GetCalleeRegsCount(RUNTIME_ARCH, true))) * PointerSize(RUNTIME_ARCH), 16)) diff --git a/runtime/class_linker.cpp b/runtime/class_linker.cpp index ef53f632f2e75914571e657b10724b5a5d60aa61..6ae4eaf08fde9e0b28216f795d9626f87b333ca6 100644 --- a/runtime/class_linker.cpp +++ b/runtime/class_linker.cpp @@ -490,7 +490,8 @@ static size_t LayoutFields(Class *klass, PandaList *tagged_fields, Pand if (is_static) { offset = klass->GetStaticFieldsOffset(); } else { - offset = (klass->GetBase() != nullptr) ? klass->GetBase()->GetObjectSize() : ObjectHeader::ObjectHeaderSize(); + offset = (klass->GetBase() != nullptr) ? klass->GetBase()->GetObjectSize() + : static_cast(ObjectHeader::ObjectHeaderSize()); } if (!ref_fields->empty()) { diff --git a/runtime/coretypes/string.cpp b/runtime/coretypes/string.cpp index 43dcca68d9e6ebf99ca2b5dff4e690ad06006a7a..63d2fb32af9ab97769ae747b182f31b13fb7dfff 100644 --- a/runtime/coretypes/string.cpp +++ b/runtime/coretypes/string.cpp @@ -264,8 +264,8 @@ int32_t String::Compare(String *rstr) if (lstr == rstr) { return 0; } - int32_t lstr_leng = lstr->GetLength(); - int32_t rstr_leng = rstr->GetLength(); + auto lstr_leng = static_cast(lstr->GetLength()); + auto rstr_leng = static_cast(rstr->GetLength()); int32_t leng_ret = lstr_leng - rstr_leng; int32_t min_count = (leng_ret < 0) ? lstr_leng : rstr_leng; if (!lstr->IsUtf16() && !rstr->IsUtf16()) { @@ -334,8 +334,8 @@ int32_t String::IndexOf(String *rhs, int32_t pos) return -1; } String *lhs = this; - int32_t lhs_count = lhs->GetLength(); - int32_t rhs_count = rhs->GetLength(); + auto lhs_count = static_cast(lhs->GetLength()); + auto rhs_count = static_cast(rhs->GetLength()); if (rhs_count == 0) { return pos; @@ -617,13 +617,13 @@ uint32_t String::ComputeHashcode() uint32_t hash; if (compressed_strings_enabled) { if (!IsUtf16()) { - hash = ComputeHashForData(GetDataMUtf8(), GetLength()); + hash = static_cast(ComputeHashForData(GetDataMUtf8(), GetLength())); } else { - hash = ComputeHashForData(GetDataUtf16(), GetLength()); + hash = static_cast(ComputeHashForData(GetDataUtf16(), GetLength())); } } else { ASSERT(static_cast(GetLength()) > (std::numeric_limits::max() >> 1U)); - hash = ComputeHashForData(GetDataUtf16(), GetLength()); + hash = static_cast(ComputeHashForData(GetDataUtf16(), GetLength())); } return hash; } @@ -639,12 +639,12 @@ uint32_t String::ComputeHashcodeMutf8(const uint8_t *mutf8_data, uint32_t utf16_ { uint32_t hash; if (can_be_compressed) { - hash = ComputeHashForMutf8(mutf8_data); + hash = static_cast(ComputeHashForMutf8(mutf8_data)); } else { auto allocator = Runtime::GetCurrent()->GetInternalAllocator(); auto tmp_buffer = allocator->AllocArray(utf16_length); utf::ConvertMUtf8ToUtf16(mutf8_data, utf::Mutf8Size(mutf8_data), tmp_buffer); - hash = ComputeHashForData(tmp_buffer, utf16_length); + hash = static_cast(ComputeHashForData(tmp_buffer, utf16_length)); allocator->Delete(tmp_buffer); } return hash; @@ -659,7 +659,7 @@ uint32_t String::ComputeHashcodeUtf16(uint16_t *utf16_data, uint32_t length) /* static */ String *String::DoReplace(String *src, uint16_t old_c, uint16_t new_c, LanguageContext ctx, PandaVM *vm) { - int32_t length = src->GetLength(); + auto length = src->GetLength(); bool can_be_compressed = IsASCIICharacter(new_c); if (src->IsUtf16()) { can_be_compressed = can_be_compressed && CanBeCompressedUtf16(src->GetDataUtf16(), length, old_c); diff --git a/runtime/include/cframe_iterators.h b/runtime/include/cframe_iterators.h index a4179ba5ac899487d7387ccd64a5c6e7bce53e23..4c443d030e9ed24889c5c0215a3ebd19af532875 100644 --- a/runtime/include/cframe_iterators.h +++ b/runtime/include/cframe_iterators.h @@ -258,7 +258,7 @@ public: ++shorty_it_; // Update slots - ptrdiff_t inc = GetSlotsCountForType(vreg_type_); + auto inc = static_cast(GetSlotsCountForType(vreg_type_)); ASSERT(inc == 1 || inc == 2); // 1 or 2 slots if (inc == 1) { if constexpr (arch::ExtArchTraits::HARDFP) { @@ -374,7 +374,7 @@ private: CFrameJniMethodIterator &HandleHardDouble() { ASSERT(vreg_type_ == VRegInfo::Type::FLOAT64); - fp_current_slot_ = RoundDown(static_cast(fp_current_slot_) + 1, 2U) - 1; + fp_current_slot_ = static_cast(RoundDown(static_cast(fp_current_slot_) + 1, 2U) - 1); if (fp_current_slot_ > fp_end_slot_) { current_slot_ = fp_current_slot_; fp_current_slot_ -= 2U; diff --git a/runtime/include/coretypes/string-inl.h b/runtime/include/coretypes/string-inl.h index 11ac8a60847da1a273fa6e70ed78319dafc948ec..6ff3d790c3cf538ffd03bcb01243d9398ab51c67 100644 --- a/runtime/include/coretypes/string-inl.h +++ b/runtime/include/coretypes/string-inl.h @@ -27,7 +27,7 @@ namespace panda::coretypes { template inline uint16_t String::At(int32_t index) { - int32_t length = GetLength(); + auto length = GetLength(); if (verify) { if ((index < 0) || (index >= length)) { panda::ThrowStringIndexOutOfBoundsException(index, length); diff --git a/runtime/include/object_accessor-inl.h b/runtime/include/object_accessor-inl.h index ab7566e23992c80a65b8dbcd7d4a2618de340d63..733b218f01658ce5d58348d0df4b68073229bf83 100644 --- a/runtime/include/object_accessor-inl.h +++ b/runtime/include/object_accessor-inl.h @@ -425,8 +425,11 @@ inline void ObjectAccessor::SetDynObject(const ManagedThread *thread, void *obj, { auto *addr = reinterpret_cast(ToUintPtr(obj) + offset); ASSERT(IsInObjectsAddressSpace(ToUintPtr(addr))); - (void)memcpy_s(reinterpret_cast(addr), coretypes::TaggedValue::TaggedTypeSize(), &value, - coretypes::TaggedValue::TaggedTypeSize()); + if (memcpy_s(reinterpret_cast(addr), coretypes::TaggedValue::TaggedTypeSize(), &value, + coretypes::TaggedValue::TaggedTypeSize()) != EOK) { + LOG(FATAL, RUNTIME) << __func__ << " memcpy_s failed"; + UNREACHABLE(); + } auto gc_post_barrier_type = GetPostBarrierType(thread); if (need_write_barrier && !mem::IsEmptyBarrier(gc_post_barrier_type)) { GetBarrierSet(thread)->PostBarrier(ToVoidPtr(ToUintPtr(obj)), value); diff --git a/runtime/interpreter/interpreter-inl.h b/runtime/interpreter/interpreter-inl.h index 00affc38df4acc870b2de05d9bcfbacafbc87910..4f232464a0079e9a371f6eac471943387371787b 100644 --- a/runtime/interpreter/interpreter-inl.h +++ b/runtime/interpreter/interpreter-inl.h @@ -2213,8 +2213,8 @@ public: template ALWAYS_INLINE void HandleCalliDynRange() { - uint16_t actual_num_args = this->GetInst().template GetImm(); - uint16_t first_arg_reg_idx = this->GetInst().template GetVReg(); + auto actual_num_args = static_cast(this->GetInst().template GetImm()); + auto first_arg_reg_idx = static_cast(this->GetInst().template GetVReg()); LOG_INST() << "calli.dyn.range " << actual_num_args << ", v" << first_arg_reg_idx; @@ -2341,7 +2341,7 @@ public: template ALWAYS_INLINE void LoadPrimitiveFieldReg(R &vreg, T *obj, Field *field) { - int64_t value = obj->template GetFieldPrimitive(*field); + auto value = static_cast(obj->template GetFieldPrimitive(*field)); vreg.SetPrimitive(value); } @@ -2389,7 +2389,7 @@ public: template ALWAYS_INLINE void LoadPrimitiveField(T *obj, Field *field) { - int64_t value = obj->template GetFieldPrimitive(*field); + auto value = static_cast(obj->template GetFieldPrimitive(*field)); this->GetAcc().SetPrimitive(value); } @@ -2740,7 +2740,7 @@ public: ALWAYS_INLINE inline void CopyCallAccShortArguments(Frame &frame, uint32_t num_vregs) { static_assert(format == BytecodeInstruction::Format::V4_IMM4_ID16, "Invalid call acc short format"); - size_t acc_position = this->GetInst().template GetImm(); + auto acc_position = static_cast(this->GetInst().template GetImm()); switch (acc_position) { case 0U: frame.GetVReg(num_vregs) = this->GetAcc(); @@ -2760,7 +2760,7 @@ public: ALWAYS_INLINE inline void CopyCallAccArguments(Frame &frame, uint32_t num_vregs) { static_assert(format == BytecodeInstruction::Format::V4_V4_V4_IMM4_ID16, "Invalid call acc format"); - size_t acc_position = this->GetInst().template GetImm(); + auto acc_position = static_cast(this->GetInst().template GetImm()); switch (acc_position) { case 0U: frame.GetVReg(num_vregs) = this->GetAcc(); @@ -2924,7 +2924,7 @@ public: uint32_t nregs; if constexpr (is_dynamic) { // +1 means function object itself - num_actual_args = this->GetInst().template GetImm() + 1; + num_actual_args = static_cast(this->GetInst().template GetImm() + 1); frame_size = num_vregs + std::max(num_declared_args, num_actual_args); nregs = frame_size; } else { diff --git a/runtime/interpreter/math_helpers.h b/runtime/interpreter/math_helpers.h index c8e89e75acb00d458b26cfb5ff14679ccfa65e65..ff0d71c599ea529c843891d9e879068d6d4f9a79 100644 --- a/runtime/interpreter/math_helpers.h +++ b/runtime/interpreter/math_helpers.h @@ -54,7 +54,7 @@ struct bit_ashr : public std::binary_function { // NOLINT(readability- using unsigned_type = std::make_unsigned_t; size_t mask = std::numeric_limits::digits - 1; size_t shift = static_cast(y) & mask; - return x >> shift; // NOLINT(hicpp-signed-bitwise) + return static_cast(static_cast(x) >> shift); } }; diff --git a/runtime/mem/gc/bitmap.h b/runtime/mem/gc/bitmap.h index 8e4b1010d333b46e8c04e893c3ac158a30bdb303..8adb635a75e9dec8612d3029b9e67c344a2b9126 100644 --- a/runtime/mem/gc/bitmap.h +++ b/runtime/mem/gc/bitmap.h @@ -172,7 +172,7 @@ protected: if (bitmap_word == 0) { break; } - offset_within_word = Ctz(bitmap_word); + offset_within_word = static_cast(Ctz(bitmap_word)); if (!visitor(offset_word_begin + offset_within_word)) { return; } diff --git a/runtime/mem/mem_stats_additional_info.cpp b/runtime/mem/mem_stats_additional_info.cpp index de884cbc5bddd2f77404f9e67335063f4bd877e7..68e1aa38053521c471e2c0e6278f408da36bd510 100644 --- a/runtime/mem/mem_stats_additional_info.cpp +++ b/runtime/mem/mem_stats_additional_info.cpp @@ -96,7 +96,8 @@ uint64_t MemStatsAdditionalInfo::GetAverageGCPhaseTime(GCPhase phase) { os::memory::LockHolder lk(phase_lock_); return phase_count_[ToIndex(phase)] != 0 - ? std::chrono::duration_cast(sum_phase_time_[ToIndex(phase)]).count() / + ? static_cast( + std::chrono::duration_cast(sum_phase_time_[ToIndex(phase)]).count()) / phase_count_[ToIndex(phase)] : 0; } diff --git a/runtime/mem/object_helpers.cpp b/runtime/mem/object_helpers.cpp index 6bac30b370cfb2caaab928dfcadf20be4ff4df92..b2072b6572eecada40047d0e300554ff7570f46f 100644 --- a/runtime/mem/object_helpers.cpp +++ b/runtime/mem/object_helpers.cpp @@ -402,7 +402,7 @@ void GCDynamicObjectHelpers::UpdateDynObjectRef(PandaVM *vm, ObjectHeader *objec << ObjectAccessor::GetDynValue(object, offset) << " to " << addr; auto *h_class = field_obj_ref->ClassAddr(); if (is_update_classword && h_class->IsHClass()) { - addr += ObjectHeader::ObjectHeaderSize(); + addr += static_cast(ObjectHeader::ObjectHeaderSize()); } auto *field_object = reinterpret_cast(addr); if (is_dyn_weak) { diff --git a/runtime/monitor.cpp b/runtime/monitor.cpp index 9a2d9462e350ac4143a365a8fb146b2e2ec7ffcd..0959c068a77a9fe41c023e1dc64150488f042781 100644 --- a/runtime/monitor.cpp +++ b/runtime/monitor.cpp @@ -370,7 +370,7 @@ Monitor::State Monitor::Wait(ObjectHeader *obj, ThreadStatus status, uint64_t ti } // Use LockHolder inside scope - int counter = monitor->recursive_counter_; + uint64_t counter = monitor->recursive_counter_; // Wait should be called under the monitor. We checked it in the previous if. // Thus, the operation with queues are thread-safe monitor->waiters_.PushFront(*thread); diff --git a/runtime/object_header.cpp b/runtime/object_header.cpp index a957bc8cd3cf3a1adb0946886a9a7daa7bbf6073..5abc56e6424710f2e09eda02a8cb35a1b253dc56 100644 --- a/runtime/object_header.cpp +++ b/runtime/object_header.cpp @@ -161,7 +161,7 @@ ObjectHeader *ObjectHeader::ShallowCopy(ObjectHeader *src) std::size_t words_to_copy = bytes_to_copy / WORD_SIZE; std::size_t remaining_offset = ObjectHeader::ObjectHeaderSize() + WORD_SIZE * words_to_copy; // copy words - for (std::size_t i = ObjectHeader::ObjectHeaderSize(); i < remaining_offset; i += WORD_SIZE) { + for (std::size_t i = static_cast(ObjectHeader::ObjectHeaderSize()); i < remaining_offset; i += WORD_SIZE) { reinterpret_cast *>(&dst_sp[i]) ->store(reinterpret_cast *>(&src_sp[i])->load(std::memory_order_relaxed), std::memory_order_relaxed); diff --git a/runtime/stack_walker.cpp b/runtime/stack_walker.cpp index cbc32e2556daf7fbb44ed3d6abbc826b46a99abf..414250c790e98da7635dd5df2fc90273ee66adb8 100644 --- a/runtime/stack_walker.cpp +++ b/runtime/stack_walker.cpp @@ -121,7 +121,7 @@ void StackWalker::InitCalleeBuffer(SlotType *callee_stack, CalleeStorage *prev_c // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) callee_stack_.stack[offset] = // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - start_slot + (callee_regs_count - Popcount(callee_stack_.callee_regs_mask >> reg)); + start_slot + (callee_regs_count - static_cast(Popcount(callee_stack_.callee_regs_mask >> reg))); } else { callee_stack_.stack[offset] = prev_callees->stack[offset]; } diff --git a/runtime/thread_manager.h b/runtime/thread_manager.h index 21164a9c281c37d7a2b04f3f44557bdfcfff05a7..3afb38a2a18636e35d97583cb00b6f18a8e3c0cd 100644 --- a/runtime/thread_manager.h +++ b/runtime/thread_manager.h @@ -238,17 +238,17 @@ private: // Due to hyerarhical structure, we need to conjunct types bool target_type = false; if ((mask & static_cast(EnumerationFlag::JAVA_THREAD)) != 0) { - target_type |= t->IsJavaThread(); + target_type ||= t->IsJavaThread(); } if ((mask & static_cast(EnumerationFlag::JS_THREAD)) != 0) { - target_type |= t->IsJSThread(); + target_type ||= t->IsJSThread(); } - target &= target_type; + target &&= target_type; } } if ((mask & static_cast(EnumerationFlag::VM_THREAD)) != 0) { - target |= t->IsVMThread(); + target ||= t->IsVMThread(); } return target; diff --git a/runtime/time_utils.cpp b/runtime/time_utils.cpp index de603693a82951fdab9fe2b66a8bda359f31fd20..19c69d51567e200eb2d14754d0e15a0ac4354f9d 100644 --- a/runtime/time_utils.cpp +++ b/runtime/time_utils.cpp @@ -39,8 +39,8 @@ PandaString GetCurrentTimeString() { PandaOStringStream result_stream; auto time_now = GetCurrentTimeInMillis(true); - time_t millisecond = time_now % MILLISECONDS_IN_SECOND; - time_t seconds = time_now / MILLISECONDS_IN_SECOND; + auto millisecond = static_cast(time_now % MILLISECONDS_IN_SECOND); + auto seconds = static_cast(time_now / MILLISECONDS_IN_SECOND); constexpr int DATE_BUFFER_SIZE = 16; PandaString date_buffer; diff --git a/runtime/tooling/debugger.h b/runtime/tooling/debugger.h index b12d9e551f044c2457b8cb529e22ef99c48f23e7..32b89f286774614e9918e21121ef8d1408afca13 100644 --- a/runtime/tooling/debugger.h +++ b/runtime/tooling/debugger.h @@ -257,7 +257,7 @@ public: } infoPtr->is_daemon = mt_managed_thread->IsDaemon(); - infoPtr->priority = mt_managed_thread->GetThreadPriority(); + infoPtr->priority = static_cast(mt_managed_thread->GetThreadPriority()); /* fields that didn't still implemented (we don't support it): * infoPtr->thread_group * infoPtr->context_class_loader diff --git a/verification/absint/abs_int_inl.h b/verification/absint/abs_int_inl.h index c0eacc0b1591e325a0322a56cbf8d56ba1e2bd47..05eb414c7fb492b8988b12ee2a9f9c8af454d503 100644 --- a/verification/absint/abs_int_inl.h +++ b/verification/absint/abs_int_inl.h @@ -3497,7 +3497,7 @@ public: LOG_INST(); DBGBRK(); uint16_t vs1 = inst_.GetVReg(); - unsigned acc_pos = inst_.GetImm(); + auto acc_pos = static_cast(inst_.GetImm()); static constexpr auto NUM_ARGS = 2; const CachedMethod *method = GetCachedMethod(); if (method != nullptr) { @@ -3598,7 +3598,7 @@ public: { LOG_INST(); DBGBRK(); - unsigned acc_pos = inst_.GetImm(); + auto acc_pos = static_cast(inst_.GetImm()); static constexpr auto NUM_ARGS = 4; const CachedMethod *method = GetCachedMethod(); if (method != nullptr) { @@ -3611,7 +3611,7 @@ public: if (i == acc_pos) { regs[i] = ACC; } else { - regs[i] = inst_.GetVReg(reg_idx++); + regs[i] = static_cast(inst_.GetVReg(reg_idx++)); } } auto fetcher = LazyFetch(regs); @@ -3666,7 +3666,7 @@ public: LOG_INST(); DBGBRK(); uint16_t vs1 = inst_.GetVReg(); - unsigned acc_pos = inst_.GetImm(); + auto acc_pos = static_cast(inst_.GetImm()); static constexpr auto NUM_ARGS = 2; const CachedMethod *method = GetCachedMethod(); if (method != nullptr) { @@ -3718,7 +3718,7 @@ public: { LOG_INST(); DBGBRK(); - unsigned acc_pos = inst_.GetImm(); + auto acc_pos = static_cast(inst_.GetImm()); static constexpr auto NUM_ARGS = 4; const CachedMethod *method = GetCachedMethod(); if (method != nullptr) { @@ -3736,7 +3736,7 @@ public: if (i == acc_pos) { regs[i] = ACC; } else { - regs[i] = inst_.GetVReg(reg_idx++); + regs[i] = static_cast(inst_.GetVReg(reg_idx++)); } } auto fetcher = LazyFetch(regs); diff --git a/verification/debug/options/msg_set_parser.h b/verification/debug/options/msg_set_parser.h index d08f0eaaee1693a805f3f42f990845e9d88bf57d..ecb87841d1414792a847a52885829c4910b6e8dc 100644 --- a/verification/debug/options/msg_set_parser.h +++ b/verification/debug/options/msg_set_parser.h @@ -45,7 +45,7 @@ const auto &NumHandler() static const auto NUM_HANDLER = [](action a, Context &c, auto from) { if (a == action::PARSED) { - size_t num = std::strtol(from, nullptr, 0); + auto num = static_cast(std::strtol(from, nullptr, 0)); c.stack.push_back(std::make_pair(num, num)); } return true; diff --git a/verification/job_queue/cache.cpp b/verification/job_queue/cache.cpp index ba6d5d02a40bb46f2ae703ba00bfeacbe3df4824..dd5cd68a844138eadb5e8c534464c47fea6bf68e 100644 --- a/verification/job_queue/cache.cpp +++ b/verification/job_queue/cache.cpp @@ -977,7 +977,7 @@ CacheOfRuntimeThings::CachedMethod &FastAPIClassRW::Link(panda::Ctz(val)); idx += i; if (idx >= size()) { return true; @@ -501,7 +501,7 @@ public: return {}; } if (val) { - size_t i = panda::Ctz(val); + auto i = static_cast(panda::Ctz(val)); idx += i; if (idx > to) { return {}; @@ -535,7 +535,7 @@ public: } if (last_word_partially_filled) { const Word MASK = MaskUpToIndex(size() & POS_MASK); - result += panda::Popcount(data_[pos] & MASK); + result += static_cast(panda::Popcount(data_[pos] & MASK)); } return result; } @@ -655,7 +655,7 @@ public: return {}; } if (val) { - size_t i = panda::Ctz(val); + auto i = static_cast(panda::Ctz(val)); idx += i; if (idx >= size) { return {}; diff --git a/verification/util/int_set.h b/verification/util/int_set.h index 960a24dc0ce9458f4fc19ae922411f8a811f7d18..1bf57e6b28ec0830358bf6498293c1a7104f8328 100644 --- a/verification/util/int_set.h +++ b/verification/util/int_set.h @@ -497,7 +497,7 @@ private: size_t Insert(T x, size_t lower_bound) { auto iter = std::lower_bound(repr_.begin() + lower_bound, repr_.end(), x); - size_t new_lower_bound = iter - repr_.begin(); + auto new_lower_bound = static_cast(iter - repr_.begin()); if (iter == repr_.end()) { repr_.push_back(x); } else if (*iter != x) { diff --git a/verification/util/saturated_enum.h b/verification/util/saturated_enum.h index 4100d4c689ce8887be96ffb5710eb05166685679..f75c564577f0a3ca0910427d7be4d26eb67a766f 100644 --- a/verification/util/saturated_enum.h +++ b/verification/util/saturated_enum.h @@ -130,7 +130,7 @@ public: protected: bool Check(Enum e, bool prev_set) const { - prev_set |= Base::value_ == E; + prev_set = prev_set || (Base::value_ == E); if (e == E) { return prev_set; } @@ -152,7 +152,7 @@ protected: template void Enumerate(Handler &&handler, bool prev_set) const { - prev_set |= Base::value_ == E; + prev_set = prev_set || (Base::value_ == E); if (prev_set && !handler(E)) { return; } diff --git a/verification/util/shifted_vector.h b/verification/util/shifted_vector.h index c48d4ba7b0a58ea17a60cb0fa4c10380e23a59b9..17f56a0d66feeaf5ad6b6fd15d042ec00ddcf7b7 100644 --- a/verification/util/shifted_vector.h +++ b/verification/util/shifted_vector.h @@ -69,7 +69,7 @@ public: void ExtendToInclude(int idx) { if (idx >= end_index()) { - Base::resize(Base::size() + (idx - end_index() + 1)); + Base::resize(Base::size() + static_cast(idx - end_index() + 1)); } } };