Compare commits

...

1 Commits

Author SHA1 Message Date
Morph
5b96cd1238 Preincrement instead of postincrement in for loops
Changes all remaining postincrements in for loops to preincrements..
2019-11-27 21:32:20 -05:00
46 changed files with 144 additions and 143 deletions

View File

@@ -36,11 +36,11 @@ Filter::Filter(double a0, double a1, double a2, double b0, double b1, double b2)
void Filter::Process(std::vector<s16>& signal) {
const std::size_t num_frames = signal.size() / 2;
for (std::size_t i = 0; i < num_frames; i++) {
for (std::size_t i = 0; i < num_frames; ++i) {
std::rotate(in.begin(), in.end() - 1, in.end());
std::rotate(out.begin(), out.end() - 1, out.end());
for (std::size_t ch = 0; ch < channel_count; ch++) {
for (std::size_t ch = 0; ch < channel_count; ++ch) {
in[0][ch] = signal[i * channel_count + ch];
out[0][ch] = b0 * in[0][ch] + b1 * in[1][ch] + b2 * in[2][ch] - a1 * out[1][ch] -
@@ -61,7 +61,7 @@ static double CascadingBiquadQ(std::size_t total_count, std::size_t index) {
CascadingFilter CascadingFilter::LowPass(double cutoff, std::size_t cascade_size) {
std::vector<Filter> cascade(cascade_size);
for (std::size_t i = 0; i < cascade_size; i++) {
for (std::size_t i = 0; i < cascade_size; ++i) {
cascade[i] = Filter::LowPass(cutoff, CascadingBiquadQ(cascade_size, i));
}
return CascadingFilter{std::move(cascade)};

View File

@@ -53,7 +53,7 @@ std::vector<s16> Interpolate(InterpolationState& state, std::vector<s16> input,
while (pos <= 1.0) {
double l = 0.0;
double r = 0.0;
for (std::size_t j = 0; j < h.size(); j++) {
for (std::size_t j = 0; j < h.size(); ++j) {
const double lanczos_calc = Lanczos(taps, pos + j - taps + 1);
l += lanczos_calc * h[j][0];
r += lanczos_calc * h[j][1];

View File

@@ -28,7 +28,7 @@ std::vector<s16> DecodeADPCM(const u8* const data, std::size_t size, const ADPCM
const std::size_t NUM_FRAMES =
(sample_count + (SAMPLES_PER_FRAME - 1)) / SAMPLES_PER_FRAME; // Round up.
for (std::size_t framei = 0; framei < NUM_FRAMES; framei++) {
for (std::size_t framei = 0; framei < NUM_FRAMES; ++framei) {
const int frame_header = data[framei * FRAME_LEN];
const int scale = 1 << (frame_header & 0xF);
const int idx = (frame_header >> 4) & 0x7;

View File

@@ -68,7 +68,7 @@ public:
std::vector<s16> buf;
buf.reserve(samples.size() * num_channels / source_num_channels);
for (std::size_t i = 0; i < samples.size(); i += source_num_channels) {
for (std::size_t ch = 0; ch < num_channels; ch++) {
for (std::size_t ch = 0; ch < num_channels; ++ch) {
buf.push_back(samples[i + ch]);
}
}
@@ -223,7 +223,7 @@ std::vector<std::string> ListCubebSinkDevices() {
if (cubeb_enumerate_devices(ctx, CUBEB_DEVICE_TYPE_OUTPUT, &collection) != CUBEB_OK) {
LOG_WARNING(Audio_Sink, "Audio output device enumeration not supported");
} else {
for (std::size_t i = 0; i < collection.count; i++) {
for (std::size_t i = 0; i < collection.count; ++i) {
const cubeb_device_info& device = collection.device[i];
if (device.friendly_name) {
device_list.emplace_back(device.friendly_name);

View File

@@ -306,7 +306,7 @@ public:
void clear() {
used_priorities = 0;
for (std::size_t i = 0; i < Depth; i++) {
for (std::size_t i = 0; i < Depth; ++i) {
levels[i].clear();
}
}

View File

@@ -101,7 +101,7 @@ struct RomFSBuildFileContext {
static u32 romfs_calc_path_hash(u32 parent, std::string_view path, u32 start,
std::size_t path_len) {
u32 hash = parent ^ 123456789;
for (u32 i = 0; i < path_len; i++) {
for (u32 i = 0; i < path_len; ++i) {
hash = (hash >> 5) | (hash << 27);
hash ^= path[start + i];
}

View File

@@ -58,7 +58,7 @@ PartitionFilesystem::PartitionFilesystem(std::shared_ptr<VfsFile> file) {
std::size_t entries_offset = sizeof(Header);
std::size_t strtab_offset = entries_offset + (pfs_header.num_entries * entry_size);
content_offset = strtab_offset + pfs_header.strtab_size;
for (u16 i = 0; i < pfs_header.num_entries; i++) {
for (u16 i = 0; i < pfs_header.num_entries; ++i) {
FSEntry entry;
memcpy(&entry, &file_data[entries_offset + (i * entry_size)], sizeof(FSEntry));
@@ -109,7 +109,7 @@ std::shared_ptr<VfsDirectory> PartitionFilesystem::GetParentDirectory() const {
void PartitionFilesystem::PrintDebugInfo() const {
LOG_DEBUG(Service_FS, "Magic: {:.4}", pfs_header.magic);
LOG_DEBUG(Service_FS, "Files: {}", pfs_header.num_entries);
for (u32 i = 0; i < pfs_header.num_entries; i++) {
for (u32 i = 0; i < pfs_header.num_entries; ++i) {
LOG_DEBUG(Service_FS, " > File {}: {} (0x{:X} bytes)", i,
pfs_files[i]->GetName(), pfs_files[i]->GetSize());
}

View File

@@ -857,7 +857,7 @@ static void ReadRegisters() {
u8* bufptr = buffer;
for (u32 reg = 0; reg <= SP_REGISTER; reg++) {
for (u32 reg = 0; reg <= SP_REGISTER; ++reg) {
LongToGdbHex(bufptr + reg * 16, RegRead(reg, current_thread));
}
@@ -873,7 +873,7 @@ static void ReadRegisters() {
u128 r;
for (u32 reg = UC_ARM64_REG_Q0; reg < FPCR_REGISTER; reg++) {
for (u32 reg = UC_ARM64_REG_Q0; reg < FPCR_REGISTER; ++reg) {
r = FpuRead(reg, current_thread);
LongToGdbHex(bufptr + reg * 32, r[0]);
LongToGdbHex(bufptr + reg * 32 + 16, r[1]);
@@ -927,7 +927,7 @@ static void WriteRegisters() {
if (command_buffer[0] != 'G')
return SendReply("E01");
for (u32 i = 0, reg = 0; reg <= FPCR_REGISTER; i++, reg++) {
for (u32 i = 0, reg = 0; reg <= FPCR_REGISTER; ++i, ++reg) {
if (reg <= SP_REGISTER) {
RegWrite(reg, GdbHexToLong(buffer_ptr + i * 16), current_thread);
} else if (reg == PC_REGISTER) {

View File

@@ -31,7 +31,7 @@ void WakeThreads(const std::vector<std::shared_ptr<Thread>>& waiting_threads, s3
}
// Signal the waiting threads.
for (std::size_t i = 0; i < last; i++) {
for (std::size_t i = 0; i < last; ++i) {
ASSERT(waiting_threads[i]->GetStatus() == ThreadStatus::WaitArb);
waiting_threads[i]->SetWaitSynchronizationResult(RESULT_SUCCESS);
waiting_threads[i]->SetArbiterWaitAddress(0);

View File

@@ -69,7 +69,7 @@ public:
}
std::optional<VAddr> ReserveSlot() {
for (std::size_t i = 0; i < is_slot_used.size(); i++) {
for (std::size_t i = 0; i < is_slot_used.size(); ++i) {
if (is_slot_used[i]) {
continue;
}

View File

@@ -126,7 +126,7 @@ bool GlobalScheduler::YieldThreadAndBalanceLoad(Thread* yielding_thread) {
scheduled_queue[core_id].yield(priority);
std::array<Thread*, NUM_CPU_CORES> current_threads;
for (u32 i = 0; i < NUM_CPU_CORES; i++) {
for (u32 i = 0; i < NUM_CPU_CORES; ++i) {
current_threads[i] = scheduled_queue[i].empty() ? nullptr : scheduled_queue[i].front();
}
@@ -179,7 +179,7 @@ bool GlobalScheduler::YieldThreadAndWaitForLoadBalancing(Thread* yielding_thread
if (scheduled_queue[core_id].empty()) {
// Here, "current_threads" is calculated after the ""yield"", unlike yield -1
std::array<Thread*, NUM_CPU_CORES> current_threads;
for (u32 i = 0; i < NUM_CPU_CORES; i++) {
for (u32 i = 0; i < NUM_CPU_CORES; ++i) {
current_threads[i] = scheduled_queue[i].empty() ? nullptr : scheduled_queue[i].front();
}
for (auto& thread : suggested_queue[core_id]) {
@@ -209,7 +209,7 @@ bool GlobalScheduler::YieldThreadAndWaitForLoadBalancing(Thread* yielding_thread
}
void GlobalScheduler::PreemptThreads() {
for (std::size_t core_id = 0; core_id < NUM_CPU_CORES; core_id++) {
for (std::size_t core_id = 0; core_id < NUM_CPU_CORES; ++core_id) {
const u32 priority = preemption_priorities[core_id];
if (scheduled_queue[core_id].size(priority) > 0) {
@@ -350,7 +350,7 @@ bool GlobalScheduler::AskForReselectionOrMarkRedundant(Thread* current_thread,
}
void GlobalScheduler::Shutdown() {
for (std::size_t core = 0; core < NUM_CPU_CORES; core++) {
for (std::size_t core = 0; core < NUM_CPU_CORES; ++core) {
scheduled_queue[core].clear();
suggested_queue[core].clear();
}

View File

@@ -624,7 +624,7 @@ static void Break(Core::System& system, u32 reason, u64 info1, u64 info2) {
debug_buffer.resize(sz);
Memory::ReadBlock(addr, debug_buffer.data(), sz);
std::string hexdump;
for (std::size_t i = 0; i < debug_buffer.size(); i++) {
for (std::size_t i = 0; i < debug_buffer.size(); ++i) {
hexdump += fmt::format("{:02X} ", debug_buffer[i]);
if (i != 0 && i % 16 == 0) {
hexdump += '\n';

View File

@@ -450,7 +450,7 @@ void Thread::AdjustSchedulingOnStatus(u32 old_flags) {
scheduler.Unschedule(current_priority, static_cast<u32>(processor_id), this);
}
for (u32 core = 0; core < GlobalScheduler::NUM_CPU_CORES; core++) {
for (u32 core = 0; core < GlobalScheduler::NUM_CPU_CORES; ++core) {
if (core != static_cast<u32>(processor_id) && ((affinity_mask >> core) & 1) != 0) {
scheduler.Unsuggest(current_priority, core, this);
}
@@ -461,7 +461,7 @@ void Thread::AdjustSchedulingOnStatus(u32 old_flags) {
scheduler.Schedule(current_priority, static_cast<u32>(processor_id), this);
}
for (u32 core = 0; core < GlobalScheduler::NUM_CPU_CORES; core++) {
for (u32 core = 0; core < GlobalScheduler::NUM_CPU_CORES; ++core) {
if (core != static_cast<u32>(processor_id) && ((affinity_mask >> core) & 1) != 0) {
scheduler.Suggest(current_priority, core, this);
}
@@ -480,7 +480,7 @@ void Thread::AdjustSchedulingOnPriority(u32 old_priority) {
scheduler.Unschedule(old_priority, static_cast<u32>(processor_id), this);
}
for (u32 core = 0; core < GlobalScheduler::NUM_CPU_CORES; core++) {
for (u32 core = 0; core < GlobalScheduler::NUM_CPU_CORES; ++core) {
if (core != static_cast<u32>(processor_id) && ((affinity_mask >> core) & 1) != 0) {
scheduler.Unsuggest(old_priority, core, this);
}
@@ -497,7 +497,7 @@ void Thread::AdjustSchedulingOnPriority(u32 old_priority) {
}
}
for (u32 core = 0; core < GlobalScheduler::NUM_CPU_CORES; core++) {
for (u32 core = 0; core < GlobalScheduler::NUM_CPU_CORES; ++core) {
if (core != static_cast<u32>(processor_id) && ((affinity_mask >> core) & 1) != 0) {
scheduler.Suggest(current_priority, core, this);
}
@@ -513,7 +513,7 @@ void Thread::AdjustSchedulingOnAffinity(u64 old_affinity_mask, s32 old_core) {
return;
}
for (u32 core = 0; core < GlobalScheduler::NUM_CPU_CORES; core++) {
for (u32 core = 0; core < GlobalScheduler::NUM_CPU_CORES; ++core) {
if (((old_affinity_mask >> core) & 1) != 0) {
if (core == static_cast<u32>(old_core)) {
scheduler.Unschedule(current_priority, core, this);
@@ -523,7 +523,7 @@ void Thread::AdjustSchedulingOnAffinity(u64 old_affinity_mask, s32 old_core) {
}
}
for (u32 core = 0; core < GlobalScheduler::NUM_CPU_CORES; core++) {
for (u32 core = 0; core < GlobalScheduler::NUM_CPU_CORES; ++core) {
if (((affinity_mask >> core) & 1) != 0) {
if (core == static_cast<u32>(processor_id)) {
scheduler.Schedule(current_priority, core, this);

View File

@@ -218,7 +218,7 @@ private:
std::vector<AudioDeviceName> name_buffer;
name_buffer.reserve(audio_device_names.size());
for (std::size_t i = 0; i < count && i < audio_device_names.size(); i++) {
for (std::size_t i = 0; i < count && i < audio_device_names.size(); ++i) {
const auto type = static_cast<DeviceType>(i);
if (!usb_output_supported && type == DeviceType::USBOutput) {

View File

@@ -79,7 +79,7 @@ static void GenerateErrorReport(Core::System& system, ResultCode error_code,
static_cast<u32>(error_code.description.Value()), info.set_flags, info.program_entry_point);
if (info.backtrace_size != 0x0) {
crash_report += "Registers:\n";
for (size_t i = 0; i < info.registers.size(); i++) {
for (size_t i = 0; i < info.registers.size(); ++i) {
crash_report +=
fmt::format(" X[{:02d}]: {:016x}\n", i, info.registers[i]);
}
@@ -91,7 +91,7 @@ static void GenerateErrorReport(Core::System& system, ResultCode error_code,
crash_report += fmt::format(" ESR: {:016x}\n", info.esr);
crash_report += fmt::format(" FAR: {:016x}\n", info.far);
crash_report += "\nBacktrace:\n";
for (size_t i = 0; i < info.backtrace_size; i++) {
for (size_t i = 0; i < info.backtrace_size; ++i) {
crash_report +=
fmt::format(" Backtrace[{:02d}]: {:016x}\n", i, info.backtrace[i]);
}

View File

@@ -172,7 +172,7 @@ void Controller_NPad::InitNewlyAddedControler(std::size_t controller_idx) {
void Controller_NPad::OnInit() {
auto& kernel = system.Kernel();
for (std::size_t i = 0; i < styleset_changed_events.size(); i++) {
for (std::size_t i = 0; i < styleset_changed_events.size(); ++i) {
styleset_changed_events[i] = Kernel::WritableEvent::CreateEventPair(
kernel, fmt::format("npad:NpadStyleSetChanged_{}", i));
}
@@ -297,7 +297,7 @@ void Controller_NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8*
std::size_t data_len) {
if (!IsControllerActivated())
return;
for (std::size_t i = 0; i < shared_memory_entries.size(); i++) {
for (std::size_t i = 0; i < shared_memory_entries.size(); ++i) {
auto& npad = shared_memory_entries[i];
const std::array<NPadGeneric*, 7> controller_npads{&npad.main_controller_states,
&npad.handheld_states,
@@ -438,7 +438,7 @@ void Controller_NPad::SetSupportedNPadIdTypes(u8* data, std::size_t length) {
supported_npad_id_types.clear();
supported_npad_id_types.resize(length / sizeof(u32));
std::memcpy(supported_npad_id_types.data(), data, length);
for (std::size_t i = 0; i < connected_controllers.size(); i++) {
for (std::size_t i = 0; i < connected_controllers.size(); ++i) {
auto& controller = connected_controllers[i];
if (!controller.is_connected) {
continue;
@@ -492,7 +492,7 @@ void Controller_NPad::VibrateController(const std::vector<u32>& controller_ids,
if (!can_controllers_vibrate) {
return;
}
for (std::size_t i = 0; i < controller_ids.size(); i++) {
for (std::size_t i = 0; i < controller_ids.size(); ++i) {
std::size_t controller_pos = NPadIdToIndex(static_cast<u32>(i));
if (connected_controllers[controller_pos].is_connected) {
// TODO(ogniK): Vibrate the physical controller

View File

@@ -126,7 +126,7 @@ struct PL_U::Impl {
// based on the shared memory dump
unsigned cur_offset = 0;
for (std::size_t i = 0; i < SHARED_FONTS.size(); i++) {
for (std::size_t i = 0; i < SHARED_FONTS.size(); ++i) {
// Out of shared fonts/invalid font
if (GetU32Swapped(input.data() + cur_offset) != EXPECTED_RESULT) {
break;
@@ -292,7 +292,7 @@ void PL_U::GetSharedFontInOrderOfPriority(Kernel::HLERequestContext& ctx) {
std::vector<u32> font_sizes;
// TODO(ogniK): Have actual priority order
for (std::size_t i = 0; i < impl->shared_font_regions.size(); i++) {
for (std::size_t i = 0; i < impl->shared_font_regions.size(); ++i) {
font_codes.push_back(static_cast<u32>(i));
auto region = impl->GetSharedFontRegion(i);
font_offsets.push_back(region.offset);

View File

@@ -38,7 +38,7 @@ void InstallInterfaces(SM::ServiceManager& service_manager, NVFlinger::NVFlinger
Module::Module(Core::System& system) {
auto& kernel = system.Kernel();
for (u32 i = 0; i < MaxNvEvents; i++) {
for (u32 i = 0; i < MaxNvEvents; ++i) {
std::string event_label = fmt::format("NVDRV::NvEvent_{}", i);
events_interface.events[i] = Kernel::WritableEvent::CreateEventPair(kernel, event_label);
events_interface.status[i] = EventState::Free;
@@ -91,7 +91,7 @@ ResultCode Module::Close(u32 fd) {
}
void Module::SignalSyncpt(const u32 syncpoint_id, const u32 value) {
for (u32 i = 0; i < MaxNvEvents; i++) {
for (u32 i = 0; i < MaxNvEvents; ++i) {
if (events_interface.assigned_syncpt[i] == syncpoint_id &&
events_interface.assigned_value[i] == value) {
events_interface.LiberateEvent(i);

View File

@@ -45,7 +45,7 @@ struct EventInterface {
static constexpr u32 unassigned_syncpt = 0xFFFFFFFF;
std::optional<u32> GetFreeEvent() const {
u64 mask = events_mask;
for (u32 i = 0; i < MaxNvEvents; i++) {
for (u32 i = 0; i < MaxNvEvents; ++i) {
const bool is_free = (mask & 0x1) == 0;
if (is_free) {
if (status[i] == EventState::Registered || status[i] == EventState::Free) {

View File

@@ -194,7 +194,7 @@ void NVFlinger::Compose() {
const auto& gpu = system.GPU();
const auto& multi_fence = buffer->get().multi_fence;
for (u32 fence_id = 0; fence_id < multi_fence.num_fences; fence_id++) {
for (u32 fence_id = 0; fence_id < multi_fence.num_fences; ++fence_id) {
const auto& fence = multi_fence.fences[fence_id];
gpu.WaitFence(fence.id, fence.value);
}

View File

@@ -349,7 +349,7 @@ Kernel::CodeSet ElfReader::LoadInto(VAddr vaddr) {
}
SectionID ElfReader::GetSectionByName(const char* name, int firstSection) const {
for (int i = firstSection; i < header->e_shnum; i++) {
for (int i = firstSection; i < header->e_shnum; ++i) {
const char* secname = GetSectionName(i);
if (secname != nullptr && strcmp(name, secname) == 0)

View File

@@ -44,7 +44,7 @@ static void MapPages(Common::PageTable& page_table, VAddr base, u64 size, u8* me
// During boot, current_page_table might not be set yet, in which case we need not flush
if (Core::System::GetInstance().IsPoweredOn()) {
auto& gpu = Core::System::GetInstance().GPU();
for (u64 i = 0; i < size; i++) {
for (u64 i = 0; i < size; ++i) {
const auto page = base + i;
if (page_table.attributes[page] == Common::PageType::RasterizerCachedMemory) {
gpu.FlushAndInvalidateRegion(page << PAGE_BITS, PAGE_SIZE);

View File

@@ -186,7 +186,7 @@ void DmntCheatVm::LogOpcode(const CheatVmOpcode& opcode) {
callbacks->CommandLog("Opcode: Save or Restore Register Mask");
callbacks->CommandLog(
fmt::format("Op Type: {:d}", static_cast<u32>(save_restore_regmask->op_type)));
for (std::size_t i = 0; i < NumRegisters; i++) {
for (std::size_t i = 0; i < NumRegisters; ++i) {
callbacks->CommandLog(
fmt::format("Act[{:02X}]: {:d}", i, save_restore_regmask->should_operate[i]));
}
@@ -538,7 +538,7 @@ bool DmntCheatVm::DecodeNextOpcode(CheatVmOpcode& out) {
// X = 16-bit bitmask, bit i --> save or restore register i.
save_restore_regmask.op_type =
static_cast<SaveRestoreRegisterOpType>((first_dword >> 20) & 0xF);
for (std::size_t i = 0; i < NumRegisters; i++) {
for (std::size_t i = 0; i < NumRegisters; ++i) {
save_restore_regmask.should_operate[i] = (first_dword & (1u << i)) != 0;
}
opcode.opcode = save_restore_regmask;
@@ -675,7 +675,7 @@ bool DmntCheatVm::LoadProgram(const std::vector<CheatEntry>& entries) {
// Reset opcode count.
num_opcodes = 0;
for (std::size_t i = 0; i < entries.size(); i++) {
for (std::size_t i = 0; i < entries.size(); ++i) {
if (entries[i].enabled) {
// Bounds check.
if (entries[i].definition.num_opcodes + num_opcodes > MaximumProgramOpcodeCount) {
@@ -683,7 +683,7 @@ bool DmntCheatVm::LoadProgram(const std::vector<CheatEntry>& entries) {
return false;
}
for (std::size_t n = 0; n < entries[i].definition.num_opcodes; n++) {
for (std::size_t n = 0; n < entries[i].definition.num_opcodes; ++n) {
program[num_opcodes++] = entries[i].definition.opcodes[n];
}
}
@@ -711,11 +711,11 @@ void DmntCheatVm::Execute(const CheatProcessMetadata& metadata) {
callbacks->CommandLog(
fmt::format("Instruction Ptr: {:04X}", static_cast<u32>(instruction_ptr)));
for (std::size_t i = 0; i < NumRegisters; i++) {
for (std::size_t i = 0; i < NumRegisters; ++i) {
callbacks->CommandLog(fmt::format("Registers[{:02X}]: {:016X}", i, registers[i]));
}
for (std::size_t i = 0; i < NumRegisters; i++) {
for (std::size_t i = 0; i < NumRegisters; ++i) {
callbacks->CommandLog(fmt::format("SavedRegs[{:02X}]: {:016X}", i, saved_values[i]));
}
LogOpcode(cur_opcode);
@@ -1137,7 +1137,7 @@ void DmntCheatVm::Execute(const CheatProcessMetadata& metadata) {
dst = registers.data();
break;
}
for (std::size_t i = 0; i < NumRegisters; i++) {
for (std::size_t i = 0; i < NumRegisters; ++i) {
if (save_restore_regmask->should_operate[i]) {
switch (save_restore_regmask->op_type) {
case SaveRestoreRegisterOpType::ClearSaved:

View File

@@ -17,7 +17,7 @@ TEST_CASE("RingBuffer: Basic Tests", "[common]") {
RingBuffer<char, 4, 1> buf;
// Pushing values into a ring buffer with space should succeed.
for (std::size_t i = 0; i < 4; i++) {
for (std::size_t i = 0; i < 4; ++i) {
const char elem = static_cast<char>(i);
const std::size_t count = buf.Push(&elem, 1);
REQUIRE(count == 1);

View File

@@ -96,7 +96,7 @@ bool TestEnvironment::TestMemory::ReadBlock(VAddr src_addr, void* dest_buffer, s
VAddr addr = src_addr;
u8* data = static_cast<u8*>(dest_buffer);
for (std::size_t i = 0; i < size; i++, addr++, data++) {
for (std::size_t i = 0; i < size; ++i, ++addr, ++data) {
*data = *Read8(addr);
}
@@ -136,7 +136,7 @@ bool TestEnvironment::TestMemory::WriteBlock(VAddr dest_addr, const void* src_bu
VAddr addr = dest_addr;
const u8* data = static_cast<const u8*>(src_buffer);
for (std::size_t i = 0; i < size; i++, addr++, data++) {
for (std::size_t i = 0; i < size; ++i, ++addr, ++data) {
env->write_records.emplace_back(8, addr, *data);
if (env->mutable_memory)
env->SetMemory8(addr, *data);

View File

@@ -111,7 +111,7 @@ TEST_CASE("CoreTiming[FairSharing]", "[core]") {
callbacks_done = 0;
u64 MAX_CALLBACKS = 10;
for (std::size_t i = 0; i < 10; i++) {
for (std::size_t i = 0; i < 10; ++i) {
core_timing.ScheduleEvent(i * 3333U, empty_callback, 0);
}

View File

@@ -1858,7 +1858,7 @@ private:
*/
static constexpr auto GetMaskAndExpect(const char* const bitstring) {
u16 mask = 0, expect = 0;
for (std::size_t i = 0; i < opcode_bitsize; i++) {
for (std::size_t i = 0; i < opcode_bitsize; ++i) {
const std::size_t bit_position = opcode_bitsize - i - 1;
switch (bitstring[i]) {
case '0':

View File

@@ -122,7 +122,7 @@ struct Header {
}
AttributeUse GetAttributeUse(u32 attribute) const {
AttributeUse result = AttributeUse::Unused;
for (u32 i = 0; i < 4; i++) {
for (u32 i = 0; i < 4; ++i) {
const auto index = GetAttributeIndexUse(attribute, i);
if (index == AttributeUse::Unused) {
continue;

View File

@@ -1025,7 +1025,7 @@ void RasterizerOpenGL::SyncViewport(OpenGLState& current_state) {
regs.IsShaderConfigEnabled(static_cast<size_t>(Maxwell::ShaderProgram::Geometry));
const std::size_t viewport_count =
geometry_shaders_enabled ? Tegra::Engines::Maxwell3D::Regs::NumViewports : 1;
for (std::size_t i = 0; i < viewport_count; i++) {
for (std::size_t i = 0; i < viewport_count; ++i) {
auto& viewport = current_state.viewports[i];
const auto& src = regs.viewports[i];
const Common::Rectangle<s32> viewport_rect{regs.viewport_transform[i].GetRect()};
@@ -1149,7 +1149,7 @@ void RasterizerOpenGL::SyncColorMask() {
const std::size_t count =
regs.independent_blend_enable ? Tegra::Engines::Maxwell3D::Regs::NumRenderTargets : 1;
for (std::size_t i = 0; i < count; i++) {
for (std::size_t i = 0; i < count; ++i) {
const auto& source = regs.color_mask[regs.color_mask_common ? 0 : i];
auto& dest = state.color_mask[i];
dest.red_enabled = (source.R == 0) ? GL_FALSE : GL_TRUE;
@@ -1198,7 +1198,7 @@ void RasterizerOpenGL::SyncBlendState() {
blend.src_a_func = MaxwellToGL::BlendFunc(src.factor_source_a);
blend.dst_a_func = MaxwellToGL::BlendFunc(src.factor_dest_a);
}
for (std::size_t i = 1; i < Tegra::Engines::Maxwell3D::Regs::NumRenderTargets; i++) {
for (std::size_t i = 1; i < Tegra::Engines::Maxwell3D::Regs::NumRenderTargets; ++i) {
state.blend[i].enabled = false;
}
maxwell3d.dirty.blend_state = false;
@@ -1206,7 +1206,7 @@ void RasterizerOpenGL::SyncBlendState() {
return;
}
for (std::size_t i = 0; i < Tegra::Engines::Maxwell3D::Regs::NumRenderTargets; i++) {
for (std::size_t i = 0; i < Tegra::Engines::Maxwell3D::Regs::NumRenderTargets; ++i) {
auto& blend = state.blend[i];
const auto& src = regs.independent_blend[i];
blend.enabled = regs.blend.enable[i] != 0;
@@ -1244,7 +1244,7 @@ void RasterizerOpenGL::SyncScissorTest(OpenGLState& current_state) {
regs.IsShaderConfigEnabled(static_cast<size_t>(Maxwell::ShaderProgram::Geometry));
const std::size_t viewport_count =
geometry_shaders_enabled ? Tegra::Engines::Maxwell3D::Regs::NumViewports : 1;
for (std::size_t i = 0; i < viewport_count; i++) {
for (std::size_t i = 0; i < viewport_count; ++i) {
const auto& src = regs.scissor_test[i];
auto& dst = current_state.viewports[i].scissor;
dst.enabled = (src.enable != 0);

View File

@@ -529,7 +529,7 @@ private:
}
void DeclareInternalFlags() {
for (u32 flag = 0; flag < static_cast<u32>(InternalFlag::Amount); flag++) {
for (u32 flag = 0; flag < static_cast<u32>(InternalFlag::Amount); ++flag) {
const auto flag_code = static_cast<InternalFlag>(flag);
code.AddLine("bool {} = false;", GetInternalFlag(flag_code));
}
@@ -2401,7 +2401,7 @@ private:
void GLSLDecompiler::DecompileAST() {
const u32 num_flow_variables = ir.GetASTNumVariables();
for (u32 i = 0; i < num_flow_variables; i++) {
for (u32 i = 0; i < num_flow_variables; ++i) {
code.AddLine("bool {} = false;", GetFlowVariable(i));
}

View File

@@ -319,7 +319,7 @@ private:
}
void DeclareFlowVariables() {
for (u32 i = 0; i < ir.GetASTNumVariables(); i++) {
for (u32 i = 0; i < ir.GetASTNumVariables(); ++i) {
const Id id = OpVariable(t_prv_bool, spv::StorageClass::Private, v_false);
Name(id, fmt::format("flow_var_{}", static_cast<u32>(i)));
flow_variables.emplace(i, AddGlobalVariable(id));
@@ -1828,7 +1828,7 @@ private:
void SPIRVDecompiler::DecompileAST() {
const u32 num_flow_variables = ir.GetASTNumVariables();
for (u32 i = 0; i < num_flow_variables; i++) {
for (u32 i = 0; i < num_flow_variables; ++i) {
const Id id = OpVariable(t_prv_bool, spv::StorageClass::Private, v_false);
Name(id, fmt::format("flow_var_{}", i));
flow_variables.emplace(i, AddGlobalVariable(id));

View File

@@ -181,7 +181,7 @@ void VKSwapchain::CreateSemaphores() {
const auto& dld{device.GetDispatchLoader()};
present_semaphores.resize(image_count);
for (std::size_t i = 0; i < image_count; i++) {
for (std::size_t i = 0; i < image_count; ++i) {
present_semaphores[i] = dev.createSemaphoreUnique({}, nullptr, dld);
}
}
@@ -191,7 +191,7 @@ void VKSwapchain::CreateImageViews() {
const auto& dld{device.GetDispatchLoader()};
image_views.resize(image_count);
for (std::size_t i = 0; i < image_count; i++) {
for (std::size_t i = 0; i < image_count; ++i) {
const vk::ImageViewCreateInfo image_view_ci({}, images[i], vk::ImageViewType::e2D,
image_format, {},
{vk::ImageAspectFlagBits::eColor, 0, 1, 0, 1});

View File

@@ -85,7 +85,7 @@ enum class BlockCollision : u32 { None, Found, Inside };
std::pair<BlockCollision, u32> TryGetBlock(CFGRebuildState& state, u32 address) {
const auto& blocks = state.block_info;
for (u32 index = 0; index < blocks.size(); index++) {
for (u32 index = 0; index < blocks.size(); ++index) {
if (blocks[index].start == address) {
return {BlockCollision::Found, index};
}
@@ -437,7 +437,7 @@ std::pair<ParseResult, ParseInfo> ParseCode(CFGRebuildState& state, u32 address)
const auto result = *tmp;
const s32 pc_target = offset + result.relative_position;
std::vector<CaseBranch> branches;
for (u32 i = 0; i < result.entries; i++) {
for (u32 i = 0; i < result.entries; ++i) {
auto key = state.locker.ObtainKey(result.buffer, result.offset + i * 4);
if (!key) {
return {ParseResult::AbnormalFlow, parse_info};

View File

@@ -131,8 +131,8 @@ std::vector<CopyParams> SurfaceBaseImpl::BreakDownLayered(const SurfaceParams& i
std::vector<CopyParams> result;
result.reserve(static_cast<std::size_t>(layers) * static_cast<std::size_t>(mipmaps));
for (u32 layer = 0; layer < layers; layer++) {
for (u32 level = 0; level < mipmaps; level++) {
for (u32 layer = 0; layer < layers; ++layer) {
for (u32 level = 0; level < mipmaps; ++level) {
const u32 width = SurfaceParams::IntersectWidth(params, in_params, level, level);
const u32 height = SurfaceParams::IntersectHeight(params, in_params, level, level);
result.emplace_back(width, height, layer, level);
@@ -146,7 +146,7 @@ std::vector<CopyParams> SurfaceBaseImpl::BreakDownNonLayered(const SurfaceParams
std::vector<CopyParams> result;
result.reserve(mipmaps);
for (u32 level = 0; level < mipmaps; level++) {
for (u32 level = 0; level < mipmaps; ++level) {
const u32 width = SurfaceParams::IntersectWidth(params, in_params, level, level);
const u32 height = SurfaceParams::IntersectHeight(params, in_params, level, level);
const u32 depth{std::min(params.GetMipDepth(level), in_params.GetMipDepth(level))};

View File

@@ -290,7 +290,7 @@ u32 SurfaceParams::GetMipBlockDepth(u32 level) const {
std::size_t SurfaceParams::GetGuestMipmapLevelOffset(u32 level) const {
std::size_t offset = 0;
for (u32 i = 0; i < level; i++) {
for (u32 i = 0; i < level; ++i) {
offset += GetInnerMipmapMemorySize(i, false, false);
}
return offset;
@@ -298,7 +298,7 @@ std::size_t SurfaceParams::GetGuestMipmapLevelOffset(u32 level) const {
std::size_t SurfaceParams::GetHostMipmapLevelOffset(u32 level) const {
std::size_t offset = 0;
for (u32 i = 0; i < level; i++) {
for (u32 i = 0; i < level; ++i) {
offset += GetInnerMipmapMemorySize(i, true, false) * GetNumLayers();
}
return offset;
@@ -306,7 +306,7 @@ std::size_t SurfaceParams::GetHostMipmapLevelOffset(u32 level) const {
std::size_t SurfaceParams::GetConvertedMipmapOffset(u32 level) const {
std::size_t offset = 0;
for (u32 i = 0; i < level; i++) {
for (u32 i = 0; i < level; ++i) {
offset += GetConvertedMipmapSize(i);
}
return offset;

View File

@@ -258,7 +258,7 @@ public:
protected:
TextureCache(Core::System& system, VideoCore::RasterizerInterface& rasterizer)
: system{system}, rasterizer{rasterizer} {
for (std::size_t i = 0; i < Tegra::Engines::Maxwell3D::Regs::NumRenderTargets; i++) {
for (std::size_t i = 0; i < Tegra::Engines::Maxwell3D::Regs::NumRenderTargets; ++i) {
SetEmptyColorBuffer(i);
}

View File

@@ -48,7 +48,7 @@ public:
unsigned int ReadBits(unsigned int nBits) {
unsigned int ret = 0;
for (unsigned int i = 0; i < nBits; i++) {
for (unsigned int i = 0; i < nBits; ++i) {
ret |= (ReadBit() & 1) << i;
}
return ret;
@@ -72,13 +72,13 @@ public:
}
void WriteBitsR(unsigned int val, unsigned int nBits) {
for (unsigned int i = 0; i < nBits; i++) {
for (unsigned int i = 0; i < nBits; ++i) {
WriteBit((val >> (nBits - i - 1)) & 1);
}
}
void WriteBits(unsigned int val, unsigned int nBits) {
for (unsigned int i = 0; i < nBits; i++) {
for (unsigned int i = 0; i < nBits; ++i) {
WriteBit((val >> i) & 1);
}
}
@@ -213,7 +213,7 @@ public:
// Count the number of bits set in a number.
static inline uint32_t Popcnt(uint32_t n) {
uint32_t c;
for (c = 0; n; c++) {
for (c = 0; n; ++c) {
n &= n - 1;
}
return c;
@@ -331,7 +331,7 @@ private:
t[0] = (Cb[1] << 1) | (Cb[0] & ~Cb[1]);
}
for (uint32_t i = 0; i < 5; i++) {
for (uint32_t i = 0; i < 5; ++i) {
IntegerEncodedValue val(eIntegerEncoding_Trit, nBitsPerValue);
val.SetBitValue(m[i]);
val.SetTritValue(t[i]);
@@ -379,7 +379,7 @@ private:
}
}
for (uint32_t i = 0; i < 3; i++) {
for (uint32_t i = 0; i < 3; ++i) {
IntegerEncodedValue val(eIntegerEncoding_Quint, nBitsPerValue);
val.m_BitValue = m[i];
val.m_QuintValue = q[i];
@@ -633,16 +633,16 @@ static void FillVoidExtentLDR(InputBitStream& strm, uint32_t* const outBuf, uint
uint32_t rgba = (r >> 8) | (g & 0xFF00) | (static_cast<uint32_t>(b) & 0xFF00) << 8 |
(static_cast<uint32_t>(a) & 0xFF00) << 16;
for (uint32_t j = 0; j < blockHeight; j++) {
for (uint32_t i = 0; i < blockWidth; i++) {
for (uint32_t j = 0; j < blockHeight; ++j) {
for (uint32_t i = 0; i < blockWidth; ++i) {
outBuf[j * blockWidth + i] = rgba;
}
}
}
static void FillError(uint32_t* outBuf, uint32_t blockWidth, uint32_t blockHeight) {
for (uint32_t j = 0; j < blockHeight; j++) {
for (uint32_t i = 0; i < blockWidth; i++) {
for (uint32_t j = 0; j < blockHeight; ++j) {
for (uint32_t i = 0; i < blockWidth; ++i) {
outBuf[j * blockWidth + i] = 0xFFFF00FF;
}
}
@@ -692,7 +692,7 @@ public:
// or by repeating the most significant bits when going from
// smaller to larger bit depths.
void ChangeBitDepth(const uint8_t (&depth)[4]) {
for (uint32_t i = 0; i < 4; i++) {
for (uint32_t i = 0; i < 4; ++i) {
Component(i) = ChangeBitDepth(Component(i), m_BitDepth[i], depth[i]);
m_BitDepth[i] = depth[i];
}
@@ -767,7 +767,7 @@ public:
}
void GetBitDepth(uint8_t (&outDepth)[4]) const {
for (int i = 0; i < 4; i++) {
for (int i = 0; i < 4; ++i) {
outDepth[i] = m_BitDepth[i];
}
}
@@ -794,7 +794,7 @@ public:
// Clamps the pixel to the range [0,255]
void ClampByte() {
for (uint32_t i = 0; i < 4; i++) {
for (uint32_t i = 0; i < 4; ++i) {
color[i] = (color[i] < 0) ? 0 : ((color[i] > 255) ? 255 : color[i]);
}
}
@@ -808,7 +808,7 @@ static void DecodeColorValues(uint32_t* out, uint8_t* data, const uint32_t* mode
const uint32_t nPartitions, const uint32_t nBitsForColorData) {
// First figure out how many color values we have
uint32_t nValues = 0;
for (uint32_t i = 0; i < nPartitions; i++) {
for (uint32_t i = 0; i < nPartitions; ++i) {
nValues += ((modes[i] >> 2) + 1) << 1;
}
@@ -969,7 +969,7 @@ static void DecodeColorValues(uint32_t* out, uint8_t* data, const uint32_t* mode
}
// Make sure that each of our values is in the proper range...
for (uint32_t i = 0; i < nValues; i++) {
for (uint32_t i = 0; i < nValues; ++i) {
assert(out[i] <= 255);
}
}
@@ -1090,9 +1090,9 @@ static void UnquantizeTexelWeights(uint32_t out[2][144],
uint32_t Dt = (1024 + (blockHeight / 2)) / (blockHeight - 1);
const uint32_t kPlaneScale = params.m_bDualPlane ? 2U : 1U;
for (uint32_t plane = 0; plane < kPlaneScale; plane++)
for (uint32_t t = 0; t < blockHeight; t++)
for (uint32_t s = 0; s < blockWidth; s++) {
for (uint32_t plane = 0; plane < kPlaneScale; ++plane)
for (uint32_t t = 0; t < blockHeight; ++t)
for (uint32_t s = 0; s < blockWidth; ++s) {
uint32_t cs = Ds * s;
uint32_t ct = Dt * t;
@@ -1262,13 +1262,13 @@ static void ComputeEndpoints(Pixel& ep1, Pixel& ep2, const uint32_t*& colorValue
uint32_t colorEndpointMode) {
#define READ_UINT_VALUES(N) \
uint32_t v[N]; \
for (uint32_t i = 0; i < N; i++) { \
for (uint32_t i = 0; i < N; ++i) { \
v[i] = *(colorValues++); \
}
#define READ_INT_VALUES(N) \
int32_t v[N]; \
for (uint32_t i = 0; i < N; i++) { \
for (uint32_t i = 0; i < N; ++i) { \
v[i] = static_cast<int32_t>(*(colorValues++)); \
}
@@ -1498,19 +1498,19 @@ static void DecompressBlock(const uint8_t inBuf[16], const uint32_t blockWidth,
CEM >>= 2;
bool C[4] = {0};
for (uint32_t i = 0; i < nPartitions; i++) {
for (uint32_t i = 0; i < nPartitions; ++i) {
C[i] = CEM & 1;
CEM >>= 1;
}
uint8_t M[4] = {0};
for (uint32_t i = 0; i < nPartitions; i++) {
for (uint32_t i = 0; i < nPartitions; ++i) {
M[i] = CEM & 3;
CEM >>= 2;
assert(M[i] <= 3);
}
for (uint32_t i = 0; i < nPartitions; i++) {
for (uint32_t i = 0; i < nPartitions; ++i) {
colorEndpointMode[i] = baseMode;
if (!(C[i]))
colorEndpointMode[i] -= 1;
@@ -1519,13 +1519,13 @@ static void DecompressBlock(const uint8_t inBuf[16], const uint32_t blockWidth,
}
} else if (nPartitions > 1) {
uint32_t CEM = baseCEM >> 2;
for (uint32_t i = 0; i < nPartitions; i++) {
for (uint32_t i = 0; i < nPartitions; ++i) {
colorEndpointMode[i] = CEM;
}
}
// Make sure everything up till here is sane.
for (uint32_t i = 0; i < nPartitions; i++) {
for (uint32_t i = 0; i < nPartitions; ++i) {
assert(colorEndpointMode[i] < 16);
}
assert(strm.GetBitsRead() + weightParams.GetPackedBitSize() == 128);
@@ -1537,7 +1537,7 @@ static void DecompressBlock(const uint8_t inBuf[16], const uint32_t blockWidth,
Pixel endpoints[4][2];
const uint32_t* colorValuesPtr = colorValues;
for (uint32_t i = 0; i < nPartitions; i++) {
for (uint32_t i = 0; i < nPartitions; ++i) {
ComputeEndpoints(endpoints[i][0], endpoints[i][1], colorValuesPtr, colorEndpointMode[i]);
}
@@ -1546,7 +1546,7 @@ static void DecompressBlock(const uint8_t inBuf[16], const uint32_t blockWidth,
memcpy(texelWeightData, inBuf, sizeof(texelWeightData));
// Reverse everything
for (uint32_t i = 0; i < 8; i++) {
for (uint32_t i = 0; i < 8; ++i) {
// Taken from http://graphics.stanford.edu/~seander/bithacks.html#ReverseByteWith64Bits
#define REVERSE_BYTE(b) (((b)*0x80200802ULL) & 0x0884422110ULL) * 0x0101010101ULL >> 32
unsigned char a = static_cast<unsigned char>(REVERSE_BYTE(texelWeightData[i]));
@@ -1577,14 +1577,14 @@ static void DecompressBlock(const uint8_t inBuf[16], const uint32_t blockWidth,
// Now that we have endpoints and weights, we can interpolate and generate
// the proper decoding...
for (uint32_t j = 0; j < blockHeight; j++)
for (uint32_t i = 0; i < blockWidth; i++) {
for (uint32_t j = 0; j < blockHeight; ++j) {
for (uint32_t i = 0; i < blockWidth; ++i) {
uint32_t partition = Select2DPartition(partitionIndex, i, j, nPartitions,
(blockHeight * blockWidth) < 32);
assert(partition < nPartitions);
Pixel p;
for (uint32_t c = 0; c < 4; c++) {
for (uint32_t c = 0; c < 4; ++c) {
uint32_t C0 = endpoints[partition][0].Component(c);
C0 = Replicate(C0, 8, 16);
uint32_t C1 = endpoints[partition][1].Component(c);
@@ -1607,6 +1607,7 @@ static void DecompressBlock(const uint8_t inBuf[16], const uint32_t blockWidth,
outBuf[j * blockWidth + i] = p.Pack();
}
}
}
} // namespace ASTCC
@@ -1618,7 +1619,7 @@ std::vector<uint8_t> Decompress(const uint8_t* data, uint32_t width, uint32_t he
uint32_t blockIdx = 0;
std::size_t depth_offset = 0;
std::vector<uint8_t> outData(height * width * depth * 4);
for (uint32_t k = 0; k < depth; k++) {
for (uint32_t k = 0; k < depth; ++k) {
for (uint32_t j = 0; j < height; j += block_height) {
for (uint32_t i = 0; i < width; i += block_width) {
@@ -1632,11 +1633,11 @@ std::vector<uint8_t> Decompress(const uint8_t* data, uint32_t width, uint32_t he
uint32_t decompHeight = std::min(block_height, height - j);
uint8_t* outRow = depth_offset + outData.data() + (j * width + i) * 4;
for (uint32_t jj = 0; jj < decompHeight; jj++) {
for (uint32_t jj = 0; jj < decompHeight; ++jj) {
memcpy(outRow + jj * width * 4, uncompData + jj * block_width, decompWidth * 4);
}
blockIdx++;
++blockIdx;
}
}
depth_offset += height * width * 4;

View File

@@ -64,12 +64,12 @@ void PreciseProcessBlock(u8* const swizzled_data, u8* const unswizzled_data, con
std::array<u8*, 2> data_ptrs;
u32 z_address = tile_offset;
for (u32 z = z_start; z < z_end; z++) {
for (u32 z = z_start; z < z_end; ++z) {
u32 y_address = z_address;
u32 pixel_base = layer_z * z + y_start * stride_x;
for (u32 y = y_start; y < y_end; y++) {
for (u32 y = y_start; y < y_end; ++y) {
const auto& table = legacy_swizzle_table[y % gob_size_y];
for (u32 x = x_start; x < x_end; x++) {
for (u32 x = x_start; x < x_end; ++x) {
const u32 swizzle_offset{y_address + table[x * bytes_per_pixel % gob_size_x]};
const u32 pixel_index{x * out_bytes_per_pixel + pixel_base};
data_ptrs[unswizzle] = swizzled_data + swizzle_offset;
@@ -99,10 +99,10 @@ void FastProcessBlock(u8* const swizzled_data, u8* const unswizzled_data, const
const u32 x_startb = x_start * bytes_per_pixel;
const u32 x_endb = x_end * bytes_per_pixel;
for (u32 z = z_start; z < z_end; z++) {
for (u32 z = z_start; z < z_end; ++z) {
u32 y_address = z_address;
u32 pixel_base = layer_z * z + y_start * stride_x;
for (u32 y = y_start; y < y_end; y++) {
for (u32 y = y_start; y < y_end; ++y) {
const auto& table = fast_swizzle_table[y % gob_size_y];
for (u32 xb = x_startb; xb < x_endb; xb += fast_swizzle_align) {
const u32 swizzle_offset{y_address + table[(xb / fast_swizzle_align) % 4]};
@@ -150,13 +150,13 @@ void SwizzledData(u8* const swizzled_data, u8* const unswizzled_data, const bool
const u32 xy_block_size = gob_size * block_height;
const u32 block_size = xy_block_size * block_depth;
u32 tile_offset = 0;
for (u32 zb = 0; zb < blocks_on_z; zb++) {
for (u32 zb = 0; zb < blocks_on_z; ++zb) {
const u32 z_start = zb * block_z_elements;
const u32 z_end = std::min(depth, z_start + block_z_elements);
for (u32 yb = 0; yb < blocks_on_y; yb++) {
for (u32 yb = 0; yb < blocks_on_y; ++yb) {
const u32 y_start = yb * block_y_elements;
const u32 y_end = std::min(height, y_start + block_y_elements);
for (u32 xb = 0; xb < blocks_on_x; xb++) {
for (u32 xb = 0; xb < blocks_on_x; ++xb) {
const u32 x_start = xb * block_x_elements;
const u32 x_end = std::min(width, x_start + block_x_elements);
if constexpr (fast) {

View File

@@ -1064,7 +1064,7 @@ void Config::SaveShortcutValues() {
// Lengths of UISettings::values.shortcuts & default_hotkeys are same.
// However, their ordering must also be the same.
for (std::size_t i = 0; i < default_hotkeys.size(); i++) {
for (std::size_t i = 0; i < default_hotkeys.size(); ++i) {
const auto& [name, group, shortcut] = UISettings::values.shortcuts[i];
const auto& default_hotkey = default_hotkeys[i].shortcut;

View File

@@ -51,7 +51,7 @@ void ConfigureAudio::SetOutputSinkFromSinkID() {
int new_sink_index = 0;
const QString sink_id = QString::fromStdString(Settings::values.sink_id);
for (int index = 0; index < ui->output_sink_combo_box->count(); index++) {
for (int index = 0; index < ui->output_sink_combo_box->count(); ++index) {
if (ui->output_sink_combo_box->itemText(index) == sink_id) {
new_sink_index = index;
break;
@@ -65,7 +65,7 @@ void ConfigureAudio::SetAudioDeviceFromDeviceID() {
int new_device_index = -1;
const QString device_id = QString::fromStdString(Settings::values.audio_device_id);
for (int index = 0; index < ui->audio_device_combo_box->count(); index++) {
for (int index = 0; index < ui->audio_device_combo_box->count(); ++index) {
if (ui->audio_device_combo_box->itemText(index) == device_id) {
new_device_index = index;
break;

View File

@@ -85,11 +85,11 @@ void ConfigureGameList::changeEvent(QEvent* event) {
void ConfigureGameList::RetranslateUI() {
ui->retranslateUi(this);
for (int i = 0; i < ui->icon_size_combobox->count(); i++) {
for (int i = 0; i < ui->icon_size_combobox->count(); ++i) {
ui->icon_size_combobox->setItemText(i, tr(default_icon_sizes[i].second));
}
for (int i = 0; i < ui->row_1_text_combobox->count(); i++) {
for (int i = 0; i < ui->row_1_text_combobox->count(); ++i) {
const QString name = tr(row_text_names[i]);
ui->row_1_text_combobox->setItemText(i, name);

View File

@@ -90,10 +90,10 @@ void ConfigureHotkeys::Configure(QModelIndex index) {
}
bool ConfigureHotkeys::IsUsedKey(QKeySequence key_sequence) const {
for (int r = 0; r < model->rowCount(); r++) {
for (int r = 0; r < model->rowCount(); ++r) {
const QStandardItem* const parent = model->item(r, 0);
for (int r2 = 0; r2 < parent->rowCount(); r2++) {
for (int r2 = 0; r2 < parent->rowCount(); ++r2) {
const QStandardItem* const key_seq_item = parent->child(r2, 1);
const auto key_seq_str = key_seq_item->text();
const auto key_seq = QKeySequence::fromString(key_seq_str, QKeySequence::NativeText);
@@ -108,9 +108,9 @@ bool ConfigureHotkeys::IsUsedKey(QKeySequence key_sequence) const {
}
void ConfigureHotkeys::ApplyConfiguration(HotkeyRegistry& registry) {
for (int key_id = 0; key_id < model->rowCount(); key_id++) {
for (int key_id = 0; key_id < model->rowCount(); ++key_id) {
const QStandardItem* parent = model->item(key_id, 0);
for (int key_column_id = 0; key_column_id < parent->rowCount(); key_column_id++) {
for (int key_column_id = 0; key_column_id < parent->rowCount(); ++key_column_id) {
const QStandardItem* action = parent->child(key_column_id, 0);
const QStandardItem* keyseq = parent->child(key_column_id, 1);
for (auto& [group, sub_actions] : registry.hotkey_groups) {

View File

@@ -237,7 +237,7 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
analog_map_stick = {ui->buttonLStickAnalog, ui->buttonRStickAnalog};
for (int button_id = 0; button_id < Settings::NativeButton::NumButtons; button_id++) {
for (int button_id = 0; button_id < Settings::NativeButton::NumButtons; ++button_id) {
auto* const button = button_map[button_id];
if (button == nullptr) {
continue;
@@ -279,8 +279,8 @@ ConfigureInputPlayer::ConfigureInputPlayer(QWidget* parent, std::size_t player_i
});
}
for (int analog_id = 0; analog_id < Settings::NativeAnalog::NumAnalogs; analog_id++) {
for (int sub_button_id = 0; sub_button_id < ANALOG_SUB_BUTTONS_NUM; sub_button_id++) {
for (int analog_id = 0; analog_id < Settings::NativeAnalog::NumAnalogs; ++analog_id) {
for (int sub_button_id = 0; sub_button_id < ANALOG_SUB_BUTTONS_NUM; ++sub_button_id) {
auto* const analog_button = analog_map_buttons[analog_id][sub_button_id];
if (analog_button == nullptr) {
continue;
@@ -452,13 +452,13 @@ void ConfigureInputPlayer::LoadConfiguration() {
}
void ConfigureInputPlayer::RestoreDefaults() {
for (int button_id = 0; button_id < Settings::NativeButton::NumButtons; button_id++) {
for (int button_id = 0; button_id < Settings::NativeButton::NumButtons; ++button_id) {
buttons_param[button_id] = Common::ParamPackage{
InputCommon::GenerateKeyboardParam(Config::default_buttons[button_id])};
}
for (int analog_id = 0; analog_id < Settings::NativeAnalog::NumAnalogs; analog_id++) {
for (int sub_button_id = 0; sub_button_id < ANALOG_SUB_BUTTONS_NUM; sub_button_id++) {
for (int analog_id = 0; analog_id < Settings::NativeAnalog::NumAnalogs; ++analog_id) {
for (int sub_button_id = 0; sub_button_id < ANALOG_SUB_BUTTONS_NUM; ++sub_button_id) {
Common::ParamPackage params{InputCommon::GenerateKeyboardParam(
Config::default_analogs[analog_id][sub_button_id])};
SetAnalogButton(params, analogs_param[analog_id], analog_sub_buttons[sub_button_id]);
@@ -468,7 +468,7 @@ void ConfigureInputPlayer::RestoreDefaults() {
}
void ConfigureInputPlayer::ClearAll() {
for (int button_id = 0; button_id < Settings::NativeButton::NumButtons; button_id++) {
for (int button_id = 0; button_id < Settings::NativeButton::NumButtons; ++button_id) {
const auto* const button = button_map[button_id];
if (button == nullptr || !button->isEnabled()) {
continue;
@@ -477,8 +477,8 @@ void ConfigureInputPlayer::ClearAll() {
buttons_param[button_id].Clear();
}
for (int analog_id = 0; analog_id < Settings::NativeAnalog::NumAnalogs; analog_id++) {
for (int sub_button_id = 0; sub_button_id < ANALOG_SUB_BUTTONS_NUM; sub_button_id++) {
for (int analog_id = 0; analog_id < Settings::NativeAnalog::NumAnalogs; ++analog_id) {
for (int sub_button_id = 0; sub_button_id < ANALOG_SUB_BUTTONS_NUM; ++sub_button_id) {
const auto* const analog_button = analog_map_buttons[analog_id][sub_button_id];
if (analog_button == nullptr || !analog_button->isEnabled()) {
continue;
@@ -492,12 +492,12 @@ void ConfigureInputPlayer::ClearAll() {
}
void ConfigureInputPlayer::UpdateButtonLabels() {
for (int button = 0; button < Settings::NativeButton::NumButtons; button++) {
for (int button = 0; button < Settings::NativeButton::NumButtons; ++button) {
button_map[button]->setText(ButtonToText(buttons_param[button]));
}
for (int analog_id = 0; analog_id < Settings::NativeAnalog::NumAnalogs; analog_id++) {
for (int sub_button_id = 0; sub_button_id < ANALOG_SUB_BUTTONS_NUM; sub_button_id++) {
for (int analog_id = 0; analog_id < Settings::NativeAnalog::NumAnalogs; ++analog_id) {
for (int sub_button_id = 0; sub_button_id < ANALOG_SUB_BUTTONS_NUM; ++sub_button_id) {
auto* const analog_button = analog_map_buttons[analog_id][sub_button_id];
if (analog_button == nullptr) {

View File

@@ -76,7 +76,7 @@ ConfigureMouseAdvanced::ConfigureMouseAdvanced(QWidget* parent)
ui->left_button, ui->right_button, ui->middle_button, ui->forward_button, ui->back_button,
};
for (int button_id = 0; button_id < Settings::NativeMouseButton::NumMouseButtons; button_id++) {
for (int button_id = 0; button_id < Settings::NativeMouseButton::NumMouseButtons; ++button_id) {
auto* const button = button_map[button_id];
if (button == nullptr) {
continue;
@@ -153,7 +153,7 @@ void ConfigureMouseAdvanced::RetranslateUI() {
}
void ConfigureMouseAdvanced::RestoreDefaults() {
for (int button_id = 0; button_id < Settings::NativeMouseButton::NumMouseButtons; button_id++) {
for (int button_id = 0; button_id < Settings::NativeMouseButton::NumMouseButtons; ++button_id) {
buttons_param[button_id] = Common::ParamPackage{
InputCommon::GenerateKeyboardParam(Config::default_mouse_buttons[button_id])};
}
@@ -173,7 +173,7 @@ void ConfigureMouseAdvanced::ClearAll() {
}
void ConfigureMouseAdvanced::UpdateButtonLabels() {
for (int button = 0; button < Settings::NativeMouseButton::NumMouseButtons; button++) {
for (int button = 0; button < Settings::NativeMouseButton::NumMouseButtons; ++button) {
button_map[button]->setText(ButtonToText(buttons_param[button]));
}
}

View File

@@ -225,7 +225,7 @@ void GameList::onTextChanged(const QString& new_text) {
}
void GameList::onUpdateThemedIcons() {
for (int i = 0; i < item_model->invisibleRootItem()->rowCount(); i++) {
for (int i = 0; i < item_model->invisibleRootItem()->rowCount(); ++i) {
QStandardItem* child = item_model->invisibleRootItem()->child(i);
const int icon_size = std::min(static_cast<int>(UISettings::values.icon_size), 64);
@@ -398,7 +398,7 @@ void GameList::ValidateEntry(const QModelIndex& item) {
}
bool GameList::isEmpty() const {
for (int i = 0; i < item_model->rowCount(); i++) {
for (int i = 0; i < item_model->rowCount(); ++i) {
const QStandardItem* child = item_model->invisibleRootItem()->child(i);
const auto type = static_cast<GameListItemType>(child->type());
if (!child->hasChildren() &&

View File

@@ -1084,7 +1084,7 @@ void GMainWindow::UpdateRecentFiles() {
const int num_recent_files =
std::min(UISettings::values.recent_files.size(), max_recent_files_item);
for (int i = 0; i < num_recent_files; i++) {
for (int i = 0; i < num_recent_files; ++i) {
const QString text = QStringLiteral("&%1. %2").arg(i + 1).arg(
QFileInfo(UISettings::values.recent_files[i]).fileName());
actions_recent_files[i]->setText(text);