1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-25 12:12:50 +01:00

Fix signed-unsigned comparisons and mark warning as error (part 2).

This commit is contained in:
Nekotekina 2020-02-19 20:03:59 +03:00
parent 771eff273b
commit 92e3eaf3ff
68 changed files with 194 additions and 202 deletions

View File

@ -304,7 +304,7 @@ std::shared_ptr<fs::device_base> fs::device_manager::set_device(const std::strin
std::shared_ptr<fs::device_base> fs::get_virtual_device(const std::string& path) std::shared_ptr<fs::device_base> fs::get_virtual_device(const std::string& path)
{ {
// Every virtual device path must have "//" at the beginning // Every virtual device path must have "//" at the beginning
if (path.size() > 2 && reinterpret_cast<const u16&>(path.front()) == "//"_u16) if (path.starts_with("//"))
{ {
return get_device_manager().get_device(path); return get_device_manager().get_device(path);
} }
@ -314,7 +314,7 @@ std::shared_ptr<fs::device_base> fs::get_virtual_device(const std::string& path)
std::shared_ptr<fs::device_base> fs::set_virtual_device(const std::string& name, const std::shared_ptr<device_base>& device) std::shared_ptr<fs::device_base> fs::set_virtual_device(const std::string& name, const std::shared_ptr<device_base>& device)
{ {
verify(HERE), name.size() > 2, name[0] == '/', name[1] == '/', name.find('/', 2) == -1; verify(HERE), name.starts_with("//"), name[2] != '/';
return get_device_manager().set_device(name, device); return get_device_manager().set_device(name, device);
} }
@ -338,7 +338,7 @@ std::string fs::get_parent_dir(const std::string& path)
if (std::exchange(last, pos - 1) != pos) if (std::exchange(last, pos - 1) != pos)
{ {
// Return empty string if the path doesn't contain at least 2 elements // Return empty string if the path doesn't contain at least 2 elements
return path.substr(0, pos != -1 && path.find_last_not_of(delim, pos, sizeof(delim) - 1) != -1 ? pos : 0); return path.substr(0, pos != umax && path.find_last_not_of(delim, pos, sizeof(delim) - 1) != umax ? pos : 0);
} }
} }
} }

View File

@ -80,7 +80,7 @@ static u8* add_jit_memory(std::size_t size, uint align)
return _pos; return _pos;
}); });
if (pos == -1) [[unlikely]] if (pos == umax) [[unlikely]]
{ {
jit_log.warning("JIT: Out of memory (size=0x%x, align=0x%x, off=0x%x)", size, align, Off); jit_log.warning("JIT: Out of memory (size=0x%x, align=0x%x, off=0x%x)", size, align, Off);
return nullptr; return nullptr;

View File

@ -464,7 +464,7 @@ logs::file_writer::file_writer(const std::string& name)
if (!flush(bufv)) if (!flush(bufv))
{ {
if (m_out == -1) if (m_out == umax)
{ {
break; break;
} }

View File

@ -1389,7 +1389,7 @@ bool handle_access_violation(u32 addr, bool is_writing, x64_context* context) no
error_code sending_error = sys_event_port_send(pf_port_id, data1, data2, data3); error_code sending_error = sys_event_port_send(pf_port_id, data1, data2, data3);
// If we fail due to being busy, wait a bit and try again. // If we fail due to being busy, wait a bit and try again.
while (sending_error == CELL_EBUSY) while (static_cast<u32>(sending_error) == CELL_EBUSY)
{ {
if (cpu->id_type() == 1) if (cpu->id_type() == 1)
{ {
@ -1411,7 +1411,7 @@ bool handle_access_violation(u32 addr, bool is_writing, x64_context* context) no
vm_log.fatal("Unknown error %x while trying to pass page fault.", +sending_error); vm_log.fatal("Unknown error %x while trying to pass page fault.", +sending_error);
cpu->state += cpu_flag::dbg_pause; cpu->state += cpu_flag::dbg_pause;
} }
// Wait until the thread is recovered // Wait until the thread is recovered
for (std::shared_lock pf_lock(pf_events->pf_mutex); for (std::shared_lock pf_lock(pf_events->pf_mutex);
pf_events->events.count(static_cast<u32>(data2)) && !sending_error;) pf_events->events.count(static_cast<u32>(data2)) && !sending_error;)

View File

@ -324,7 +324,7 @@ int decrypt_data(const fs::file* in, const fs::file* out, EDAT_HEADER *edat, NPD
in->seek(0); in->seek(0);
memset(data.get(), 0, edat->block_size); memset(data.get(), 0, edat->block_size);
u64 res = decrypt_block(in, data.get(), edat, npd, crypt_key, i, total_blocks, size_left); u64 res = decrypt_block(in, data.get(), edat, npd, crypt_key, i, total_blocks, size_left);
if (res == -1) if (res == umax)
{ {
edat_log.error("EDAT: Decrypt Block failed!"); edat_log.error("EDAT: Decrypt Block failed!");
return 1; return 1;
@ -966,7 +966,7 @@ u64 EDATADecrypter::ReadData(u64 pos, u8* data, u64 size)
{ {
edata_file.seek(0); edata_file.seek(0);
u64 res = decrypt_block(&edata_file, &data_buf[writeOffset], &edatHeader, &npdHeader, dec_key.data(), i, total_blocks, edatHeader.file_size); u64 res = decrypt_block(&edata_file, &data_buf[writeOffset], &edatHeader, &npdHeader, dec_key.data(), i, total_blocks, edatHeader.file_size);
if (res == -1) if (res == umax)
{ {
edat_log.error("Error Decrypting data"); edat_log.error("Error Decrypting data");
return 0; return 0;

View File

@ -155,7 +155,7 @@ bool ALSABackend::AddData(const void* src, u32 num_samples)
return false; return false;
} }
if (res != num_frames) if (res + 0u != num_frames)
{ {
ALSA.warning("Error (%d)", res); ALSA.warning("Error (%d)", res);
return false; return false;

View File

@ -443,7 +443,7 @@ error_code cellFsReadWithOffset(ppu_thread& ppu, u32 fd, u64 offset, vm::ptr<voi
// Write size read // Write size read
if (nread) if (nread)
{ {
*nread = rc && rc != CELL_EFSSPECIFIC ? 0 : arg->out_size.value(); *nread = rc && rc + 0u != CELL_EFSSPECIFIC ? 0 : arg->out_size.value();
} }
if (!rc && arg->out_code) if (!rc && arg->out_code)
@ -485,7 +485,7 @@ error_code cellFsWriteWithOffset(ppu_thread& ppu, u32 fd, u64 offset, vm::cptr<v
// Write size written // Write size written
if (nwrite) if (nwrite)
{ {
*nwrite = rc && rc != CELL_EFSSPECIFIC ? 0 : arg->out_size.value(); *nwrite = rc && rc + 0u != CELL_EFSSPECIFIC ? 0 : arg->out_size.value();
} }
if (!rc && arg->out_code) if (!rc && arg->out_code)

View File

@ -237,7 +237,7 @@ s32 _ConvertStr(s32 src_code, const void *src, s32 src_len, s32 dst_code, void *
size_t dstLen = *dst_len; size_t dstLen = *dst_len;
size_t ictd = iconv(ict, const_cast<char**>(reinterpret_cast<const char**>(&src)), &srcLen, reinterpret_cast<char**>(&dst), &dstLen); size_t ictd = iconv(ict, const_cast<char**>(reinterpret_cast<const char**>(&src)), &srcLen, reinterpret_cast<char**>(&dst), &dstLen);
*dst_len -= dstLen; *dst_len -= dstLen;
if (ictd == -1) if (ictd == umax)
{ {
if (errno == EILSEQ) if (errno == EILSEQ)
retValue = SRCIllegal; //Invalid multi-byte sequence retValue = SRCIllegal; //Invalid multi-byte sequence
@ -262,7 +262,7 @@ s32 _ConvertStr(s32 src_code, const void *src, s32 src_len, s32 dst_code, void *
size_t bufLeft = sizeof(buf); size_t bufLeft = sizeof(buf);
size_t ictd = iconv(ict, const_cast<char**>(reinterpret_cast<const char**>(&src)), &srcLen, reinterpret_cast<char**>(&dst), &bufLeft); size_t ictd = iconv(ict, const_cast<char**>(reinterpret_cast<const char**>(&src)), &srcLen, reinterpret_cast<char**>(&dst), &bufLeft);
*dst_len += sizeof(buf) - bufLeft; *dst_len += sizeof(buf) - bufLeft;
if (ictd == -1 && errno != E2BIG) if (ictd == umax && errno != E2BIG)
{ {
if (errno == EILSEQ) if (errno == EILSEQ)
retValue = SRCIllegal; retValue = SRCIllegal;

View File

@ -716,7 +716,7 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v
{ {
case CELL_SAVEDATA_FOCUSPOS_DIRNAME: case CELL_SAVEDATA_FOCUSPOS_DIRNAME:
{ {
for (s32 i = 0; i < save_entries.size(); i++) for (u32 i = 0; i < save_entries.size(); i++)
{ {
if (save_entries[i].dirName == listSet->focusDirName.get_ptr()) if (save_entries[i].dirName == listSet->focusDirName.get_ptr())
{ {
@ -741,7 +741,7 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v
{ {
s64 max = INT64_MIN; s64 max = INT64_MIN;
for (s32 i = 0; i < save_entries.size(); i++) for (u32 i = 0; i < save_entries.size(); i++)
{ {
if (save_entries[i].mtime > max) if (save_entries[i].mtime > max)
{ {
@ -756,7 +756,7 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v
{ {
s64 min = INT64_MAX; s64 min = INT64_MAX;
for (s32 i = 0; i < save_entries.size(); i++) for (u32 i = 0; i < save_entries.size(); i++)
{ {
if (save_entries[i].mtime < min) if (save_entries[i].mtime < min)
{ {
@ -949,7 +949,7 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v
return {CELL_SAVEDATA_ERROR_PARAM, "26"}; return {CELL_SAVEDATA_ERROR_PARAM, "26"};
} }
for (s32 i = 0; i < save_entries.size(); i++) for (u32 i = 0; i < save_entries.size(); i++)
{ {
if (save_entries[i].dirName == fixedSet->dirName.get_ptr()) if (save_entries[i].dirName == fixedSet->dirName.get_ptr())
{ {
@ -1020,7 +1020,7 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v
if (selected >= 0) if (selected >= 0)
{ {
if (selected < save_entries.size()) if (selected + 0u < save_entries.size())
{ {
save_entry.dirName = std::move(save_entries[selected].dirName); save_entry.dirName = std::move(save_entries[selected].dirName);
save_entry.escaped = vfs::escape(save_entry.dirName); save_entry.escaped = vfs::escape(save_entry.dirName);
@ -1589,7 +1589,7 @@ static NEVER_INLINE error_code savedata_op(ppu_thread& ppu, u32 operation, u32 v
fs::remove_all(old_path); fs::remove_all(old_path);
} }
if (savedata_result == CELL_SAVEDATA_ERROR_CBRESULT) if (savedata_result + 0u == CELL_SAVEDATA_ERROR_CBRESULT)
{ {
return display_callback_result_error_message(ppu, result, errDialog); return display_callback_result_error_message(ppu, result, errDialog);
} }

View File

@ -60,7 +60,7 @@ struct search_info
vm::ptr<CellSearchSystemCallback> func; vm::ptr<CellSearchSystemCallback> func;
vm::ptr<void> userData; vm::ptr<void> userData;
atomic_t<search_state> state = search_state::not_initialized; atomic_t<search_state> state = search_state::not_initialized;
shared_mutex links_mutex; shared_mutex links_mutex;
std::unordered_map<std::string, std::string> content_links; std::unordered_map<std::string, std::string> content_links;
@ -653,7 +653,7 @@ error_code cellSearchGetContentInfoByOffset(CellSearchId searchId, s32 offset, v
return CELL_SEARCH_ERROR_GENERIC; return CELL_SEARCH_ERROR_GENERIC;
} }
if (offset >= 0 && offset < searchObject->content_ids.size()) if (offset >= 0 && offset + 0u < searchObject->content_ids.size())
{ {
const auto& content_id = searchObject->content_ids[offset]; const auto& content_id = searchObject->content_ids[offset];
const auto& content_info = content_id.second; const auto& content_info = content_id.second;
@ -842,7 +842,7 @@ error_code cellSearchGetContentIdByOffset(CellSearchId searchId, s32 offset, vm:
return CELL_SEARCH_ERROR_GENERIC; return CELL_SEARCH_ERROR_GENERIC;
} }
if (offset > -1 && offset < searchObject->content_ids.size()) if (offset >= 0 && offset + 0u < searchObject->content_ids.size())
{ {
auto& content_id = searchObject->content_ids.at(offset); auto& content_id = searchObject->content_ids.at(offset);
const u128 content_id_128 = content_id.first; const u128 content_id_128 = content_id.first;

View File

@ -20,18 +20,7 @@ LOG_CHANNEL(cellSpurs);
error_code sys_spu_image_close(ppu_thread&, vm::ptr<sys_spu_image> img); error_code sys_spu_image_close(ppu_thread&, vm::ptr<sys_spu_image> img);
// TODO #define CHECK_SUCCESS(expr) if (error_code error = (expr); error < 0) fmt::throw_exception("Failure: %s -> 0x%x" HERE, #expr, error.value)
struct cell_error_t
{
s32 value;
explicit operator bool() const
{
return (value < 0);
}
};
#define CHECK_SUCCESS(expr) if (cell_error_t error{expr}) fmt::throw_exception("Failure: %s -> 0x%x" HERE, #expr, error.value)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// Function prototypes // Function prototypes
@ -428,7 +417,7 @@ s32 _spurs::attach_lv2_eq(ppu_thread& ppu, vm::ptr<CellSpurs> spurs, u32 queue,
if (s32 res = sys_spu_thread_group_connect_event_all_threads(ppu, spurs->spuTG, queue, portMask, port)) if (s32 res = sys_spu_thread_group_connect_event_all_threads(ppu, spurs->spuTG, queue, portMask, port))
{ {
if (res == CELL_EISCONN) if (res + 0u == CELL_EISCONN)
{ {
return CELL_SPURS_CORE_ERROR_BUSY; return CELL_SPURS_CORE_ERROR_BUSY;
} }
@ -577,7 +566,7 @@ void _spurs::handler_entry(ppu_thread& ppu, vm::ptr<CellSpurs> spurs)
if (s32 rc = sys_spu_thread_group_join(ppu, spurs->spuTG, vm::var<u32>{}, vm::var<u32>{})) if (s32 rc = sys_spu_thread_group_join(ppu, spurs->spuTG, vm::var<u32>{}, vm::var<u32>{}))
{ {
if (rc == CELL_ESTAT) if (rc + 0u == CELL_ESTAT)
{ {
return sys_ppu_thread_exit(ppu, 0); return sys_ppu_thread_exit(ppu, 0);
} }
@ -850,7 +839,7 @@ s32 _spurs::finalize_spu(ppu_thread& ppu, vm::ptr<CellSpurs> spurs)
if (s32 rc = sys_spu_thread_group_destroy(ppu, spurs->spuTG)) if (s32 rc = sys_spu_thread_group_destroy(ppu, spurs->spuTG))
{ {
if (rc == CELL_EBUSY) if (rc + 0u == CELL_EBUSY)
{ {
continue; continue;
} }
@ -2817,7 +2806,7 @@ s32 cellSpursEventFlagSet(ppu_thread& ppu, vm::ptr<CellSpursEventFlag> eventFlag
} }
auto rc = _cellSpursSendSignal(ppu, *taskset, eventFlag->waitingTaskId[i]); auto rc = _cellSpursSendSignal(ppu, *taskset, eventFlag->waitingTaskId[i]);
if (rc == CELL_SPURS_TASK_ERROR_INVAL || rc == CELL_SPURS_TASK_ERROR_STAT) if (rc + 0u == CELL_SPURS_TASK_ERROR_INVAL || rc + 0u == CELL_SPURS_TASK_ERROR_STAT)
{ {
return CELL_SPURS_TASK_ERROR_FATAL; return CELL_SPURS_TASK_ERROR_FATAL;
} }
@ -3533,7 +3522,7 @@ s32 _spurs::task_start(ppu_thread& ppu, vm::ptr<CellSpursTaskset> taskset, u32 t
if (s32 rc = cellSpursWakeUp(ppu, taskset->spurs)) if (s32 rc = cellSpursWakeUp(ppu, taskset->spurs))
{ {
if (rc == CELL_SPURS_POLICY_MODULE_ERROR_STAT) if (rc + 0u == CELL_SPURS_POLICY_MODULE_ERROR_STAT)
{ {
rc = CELL_SPURS_TASK_ERROR_STAT; rc = CELL_SPURS_TASK_ERROR_STAT;
} }
@ -3610,7 +3599,7 @@ s32 _cellSpursSendSignal(ppu_thread& ppu, vm::ptr<CellSpursTaskset> taskset, u32
{ {
cellSpursSendWorkloadSignal(taskset->spurs, taskset->wid); cellSpursSendWorkloadSignal(taskset->spurs, taskset->wid);
auto rc = cellSpursWakeUp(ppu, taskset->spurs); auto rc = cellSpursWakeUp(ppu, taskset->spurs);
if (rc == CELL_SPURS_POLICY_MODULE_ERROR_STAT) if (rc + 0u == CELL_SPURS_POLICY_MODULE_ERROR_STAT)
{ {
return CELL_SPURS_TASK_ERROR_STAT; return CELL_SPURS_TASK_ERROR_STAT;
} }

View File

@ -262,7 +262,7 @@ bool spursKernel1SelectWorkload(spu_thread& spu)
// Calculate the contention (number of SPUs used) for each workload // Calculate the contention (number of SPUs used) for each workload
u8 contention[CELL_SPURS_MAX_WORKLOAD]; u8 contention[CELL_SPURS_MAX_WORKLOAD];
u8 pendingContention[CELL_SPURS_MAX_WORKLOAD]; u8 pendingContention[CELL_SPURS_MAX_WORKLOAD];
for (auto i = 0; i < CELL_SPURS_MAX_WORKLOAD; i++) for (u32 i = 0; i < CELL_SPURS_MAX_WORKLOAD; i++)
{ {
contention[i] = spurs->wklCurrentContention[i] - ctxt->wklLocContention[i]; contention[i] = spurs->wklCurrentContention[i] - ctxt->wklLocContention[i];
@ -296,7 +296,7 @@ bool spursKernel1SelectWorkload(spu_thread& spu)
{ {
// Caclulate the scheduling weight for each workload // Caclulate the scheduling weight for each workload
u16 maxWeight = 0; u16 maxWeight = 0;
for (auto i = 0; i < CELL_SPURS_MAX_WORKLOAD; i++) for (u32 i = 0; i < CELL_SPURS_MAX_WORKLOAD; i++)
{ {
u16 runnable = ctxt->wklRunnable1 & (0x8000 >> i); u16 runnable = ctxt->wklRunnable1 & (0x8000 >> i);
u16 wklSignal = spurs->wklSignal1.load() & (0x8000 >> i); u16 wklSignal = spurs->wklSignal1.load() & (0x8000 >> i);
@ -371,7 +371,7 @@ bool spursKernel1SelectWorkload(spu_thread& spu)
contention[wklSelectedId]++; contention[wklSelectedId]++;
} }
for (auto i = 0; i < CELL_SPURS_MAX_WORKLOAD; i++) for (u32 i = 0; i < CELL_SPURS_MAX_WORKLOAD; i++)
{ {
spurs->wklCurrentContention[i] = contention[i]; spurs->wklCurrentContention[i] = contention[i];
spurs->wklPendingContention[i] = spurs->wklPendingContention[i] - ctxt->wklLocPendingContention[i]; spurs->wklPendingContention[i] = spurs->wklPendingContention[i] - ctxt->wklLocPendingContention[i];
@ -395,7 +395,7 @@ bool spursKernel1SelectWorkload(spu_thread& spu)
pendingContention[wklSelectedId]++; pendingContention[wklSelectedId]++;
} }
for (auto i = 0; i < CELL_SPURS_MAX_WORKLOAD; i++) for (u32 i = 0; i < CELL_SPURS_MAX_WORKLOAD; i++)
{ {
spurs->wklPendingContention[i] = pendingContention[i]; spurs->wklPendingContention[i] = pendingContention[i];
ctxt->wklLocPendingContention[i] = 0; ctxt->wklLocPendingContention[i] = 0;
@ -409,7 +409,7 @@ bool spursKernel1SelectWorkload(spu_thread& spu)
else else
{ {
// Not called by kernel and no context switch is required // Not called by kernel and no context switch is required
for (auto i = 0; i < CELL_SPURS_MAX_WORKLOAD; i++) for (u32 i = 0; i < CELL_SPURS_MAX_WORKLOAD; i++)
{ {
spurs->wklPendingContention[i] = spurs->wklPendingContention[i] - ctxt->wklLocPendingContention[i]; spurs->wklPendingContention[i] = spurs->wklPendingContention[i] - ctxt->wklLocPendingContention[i];
ctxt->wklLocPendingContention[i] = 0; ctxt->wklLocPendingContention[i] = 0;
@ -446,17 +446,17 @@ bool spursKernel2SelectWorkload(spu_thread& spu)
// Calculate the contention (number of SPUs used) for each workload // Calculate the contention (number of SPUs used) for each workload
u8 contention[CELL_SPURS_MAX_WORKLOAD2]; u8 contention[CELL_SPURS_MAX_WORKLOAD2];
u8 pendingContention[CELL_SPURS_MAX_WORKLOAD2]; u8 pendingContention[CELL_SPURS_MAX_WORKLOAD2];
for (auto i = 0; i < CELL_SPURS_MAX_WORKLOAD2; i++) for (u32 i = 0; i < CELL_SPURS_MAX_WORKLOAD2; i++)
{ {
contention[i] = spurs->wklCurrentContention[i & 0x0F] - ctxt->wklLocContention[i & 0x0F]; contention[i] = spurs->wklCurrentContention[i & 0x0F] - ctxt->wklLocContention[i & 0x0F];
contention[i] = i < CELL_SPURS_MAX_WORKLOAD ? contention[i] & 0x0F : contention[i] >> 4; contention[i] = i + 0u < CELL_SPURS_MAX_WORKLOAD ? contention[i] & 0x0F : contention[i] >> 4;
// If this is a poll request then the number of SPUs pending to context switch is also added to the contention presumably // If this is a poll request then the number of SPUs pending to context switch is also added to the contention presumably
// to prevent unnecessary jumps to the kernel // to prevent unnecessary jumps to the kernel
if (isPoll) if (isPoll)
{ {
pendingContention[i] = spurs->wklPendingContention[i & 0x0F] - ctxt->wklLocPendingContention[i & 0x0F]; pendingContention[i] = spurs->wklPendingContention[i & 0x0F] - ctxt->wklLocPendingContention[i & 0x0F];
pendingContention[i] = i < CELL_SPURS_MAX_WORKLOAD ? pendingContention[i] & 0x0F : pendingContention[i] >> 4; pendingContention[i] = i + 0u < CELL_SPURS_MAX_WORKLOAD ? pendingContention[i] & 0x0F : pendingContention[i] >> 4;
if (i != ctxt->wklCurrentId) if (i != ctxt->wklCurrentId)
{ {
contention[i] += pendingContention[i]; contention[i] += pendingContention[i];
@ -483,9 +483,9 @@ bool spursKernel2SelectWorkload(spu_thread& spu)
{ {
// Caclulate the scheduling weight for each workload // Caclulate the scheduling weight for each workload
u8 maxWeight = 0; u8 maxWeight = 0;
for (auto i = 0; i < CELL_SPURS_MAX_WORKLOAD2; i++) for (u32 i = 0; i < CELL_SPURS_MAX_WORKLOAD2; i++)
{ {
auto j = i & 0x0F; u32 j = i & 0x0f;
u16 runnable = i < CELL_SPURS_MAX_WORKLOAD ? ctxt->wklRunnable1 & (0x8000 >> j) : ctxt->wklRunnable2 & (0x8000 >> j); u16 runnable = i < CELL_SPURS_MAX_WORKLOAD ? ctxt->wklRunnable1 & (0x8000 >> j) : ctxt->wklRunnable2 & (0x8000 >> j);
u8 priority = i < CELL_SPURS_MAX_WORKLOAD ? ctxt->priority[j] & 0x0F : ctxt->priority[j] >> 4; u8 priority = i < CELL_SPURS_MAX_WORKLOAD ? ctxt->priority[j] & 0x0F : ctxt->priority[j] >> 4;
u8 maxContention = i < CELL_SPURS_MAX_WORKLOAD ? spurs->wklMaxContention[j] & 0x0F : spurs->wklMaxContention[j] >> 4; u8 maxContention = i < CELL_SPURS_MAX_WORKLOAD ? spurs->wklMaxContention[j] & 0x0F : spurs->wklMaxContention[j] >> 4;
@ -551,7 +551,7 @@ bool spursKernel2SelectWorkload(spu_thread& spu)
contention[wklSelectedId]++; contention[wklSelectedId]++;
} }
for (auto i = 0; i < (CELL_SPURS_MAX_WORKLOAD2 >> 1); i++) for (u32 i = 0; i < (CELL_SPURS_MAX_WORKLOAD2 >> 1); i++)
{ {
spurs->wklCurrentContention[i] = contention[i] | (contention[i + 0x10] << 4); spurs->wklCurrentContention[i] = contention[i] | (contention[i + 0x10] << 4);
spurs->wklPendingContention[i] = spurs->wklPendingContention[i] - ctxt->wklLocPendingContention[i]; spurs->wklPendingContention[i] = spurs->wklPendingContention[i] - ctxt->wklLocPendingContention[i];
@ -571,7 +571,7 @@ bool spursKernel2SelectWorkload(spu_thread& spu)
pendingContention[wklSelectedId]++; pendingContention[wklSelectedId]++;
} }
for (auto i = 0; i < (CELL_SPURS_MAX_WORKLOAD2 >> 1); i++) for (u32 i = 0; i < (CELL_SPURS_MAX_WORKLOAD2 >> 1); i++)
{ {
spurs->wklPendingContention[i] = pendingContention[i] | (pendingContention[i + 0x10] << 4); spurs->wklPendingContention[i] = pendingContention[i] | (pendingContention[i + 0x10] << 4);
ctxt->wklLocPendingContention[i] = 0; ctxt->wklLocPendingContention[i] = 0;
@ -582,7 +582,7 @@ bool spursKernel2SelectWorkload(spu_thread& spu)
else else
{ {
// Not called by kernel and no context switch is required // Not called by kernel and no context switch is required
for (auto i = 0; i < CELL_SPURS_MAX_WORKLOAD; i++) for (u32 i = 0; i < CELL_SPURS_MAX_WORKLOAD; i++)
{ {
spurs->wklPendingContention[i] = spurs->wklPendingContention[i] - ctxt->wklLocPendingContention[i]; spurs->wklPendingContention[i] = spurs->wklPendingContention[i] - ctxt->wklLocPendingContention[i];
ctxt->wklLocPendingContention[i] = 0; ctxt->wklLocPendingContention[i] = 0;

View File

@ -112,7 +112,7 @@ error_code cellSslCertificateLoader(u64 flag, vm::ptr<char> buffer, u32 size, vm
if (required) if (required)
{ {
*required = 0; *required = 0;
for (int i = 1; i <= flagBits.size(); i++) for (uint i = 1; i <= flagBits.size(); i++)
{ {
if (!flagBits[i-1]) if (!flagBits[i-1])
continue; continue;
@ -123,7 +123,7 @@ error_code cellSslCertificateLoader(u64 flag, vm::ptr<char> buffer, u32 size, vm
else else
{ {
std::string final; std::string final;
for (int i = 1; i <= flagBits.size(); i++) for (uint i = 1; i <= flagBits.size(); i++)
{ {
if (!flagBits[i-1]) if (!flagBits[i-1])
continue; continue;

View File

@ -1087,7 +1087,7 @@ error_code _cellSyncLFQueueCompletePushPointer(ppu_thread& ppu, vm::ptr<CellSync
if (queue->push2.compare_and_swap_test(old, push2)) if (queue->push2.compare_and_swap_test(old, push2))
{ {
verify(HERE), (var2 + var4 < 16); verify(HERE), (var2 + var4 < 16);
if (var6 != -1) if (var6 != umax)
{ {
verify(HERE), (queue->push3.compare_and_swap_test(old2, push3)); verify(HERE), (queue->push3.compare_and_swap_test(old2, push3));
verify(HERE), (fpSendSignal); verify(HERE), (fpSendSignal);
@ -1146,7 +1146,7 @@ error_code _cellSyncLFQueuePushBody(ppu_thread& ppu, vm::ptr<CellSyncLFQueue> qu
res = _cellSyncLFQueueGetPushPointer2(ppu, queue, position, isBlocking, 0); res = _cellSyncLFQueueGetPushPointer2(ppu, queue, position, isBlocking, 0);
} }
if (!isBlocking || res != CELL_SYNC_ERROR_AGAIN) if (!isBlocking || res + 0u != CELL_SYNC_ERROR_AGAIN)
{ {
if (res) return not_an_error(res); if (res) return not_an_error(res);
@ -1386,7 +1386,7 @@ error_code _cellSyncLFQueueCompletePopPointer(ppu_thread& ppu, vm::ptr<CellSyncL
if (queue->pop2.compare_and_swap_test(old, pop2)) if (queue->pop2.compare_and_swap_test(old, pop2))
{ {
if (var6 != -1) if (var6 != umax)
{ {
verify(HERE), (queue->pop3.compare_and_swap_test(old2, pop3)); verify(HERE), (queue->pop3.compare_and_swap_test(old2, pop3));
verify(HERE), (fpSendSignal); verify(HERE), (fpSendSignal);
@ -1445,7 +1445,7 @@ error_code _cellSyncLFQueuePopBody(ppu_thread& ppu, vm::ptr<CellSyncLFQueue> que
res = _cellSyncLFQueueGetPopPointer2(ppu, queue, position, isBlocking, 0); res = _cellSyncLFQueueGetPopPointer2(ppu, queue, position, isBlocking, 0);
} }
if (!isBlocking || res != CELL_SYNC_ERROR_AGAIN) if (!isBlocking || res + 0u != CELL_SYNC_ERROR_AGAIN)
{ {
if (res) return not_an_error(res); if (res) return not_an_error(res);

View File

@ -227,15 +227,15 @@ struct vdec_context final
packet.data = vm::_ptr<u8>(au_addr); packet.data = vm::_ptr<u8>(au_addr);
packet.size = au_size; packet.size = au_size;
packet.pts = au_pts != -1 ? au_pts : INT64_MIN; packet.pts = au_pts != umax ? au_pts : INT64_MIN;
packet.dts = au_dts != -1 ? au_dts : INT64_MIN; packet.dts = au_dts != umax ? au_dts : INT64_MIN;
if (next_pts == 0 && au_pts != -1) if (next_pts == 0 && au_pts != umax)
{ {
next_pts = au_pts; next_pts = au_pts;
} }
if (next_dts == 0 && au_dts != -1) if (next_dts == 0 && au_dts != umax)
{ {
next_dts = au_dts; next_dts = au_dts;
} }
@ -528,7 +528,7 @@ static error_code vdecQueryAttr(s32 type, u32 profile, u32 spec_addr /* may be 0
{ {
return CELL_VDEC_ERROR_ARG; return CELL_VDEC_ERROR_ARG;
} }
memSize = new_sdk ? 0xD2F40B : 0xEB990B; memSize = new_sdk ? 0xD2F40B : 0xEB990B;
break; break;
} }

View File

@ -280,8 +280,8 @@ error_code cellVideoOutGetResolutionAvailability(u32 videoOut, u32 resolutionId,
switch (videoOut) switch (videoOut)
{ {
case CELL_VIDEO_OUT_PRIMARY: return not_an_error( case CELL_VIDEO_OUT_PRIMARY: return not_an_error(
resolutionId == g_video_out_resolution_id.at(g_cfg.video.resolution) resolutionId == g_video_out_resolution_id.at(g_cfg.video.resolution) + 0u
&& (aspect == CELL_VIDEO_OUT_ASPECT_AUTO || aspect == g_video_out_aspect_id.at(g_cfg.video.aspect_ratio)) && (aspect == CELL_VIDEO_OUT_ASPECT_AUTO || aspect == g_video_out_aspect_id.at(g_cfg.video.aspect_ratio) + 0u)
); );
case CELL_VIDEO_OUT_SECONDARY: return not_an_error(0); case CELL_VIDEO_OUT_SECONDARY: return not_an_error(0);
} }

View File

@ -412,7 +412,7 @@ struct surmixer_thread : ppu_thread
g_surmx.mixdata[i * 8 + 1] += right; g_surmx.mixdata[i * 8 + 1] += right;
} }
if ((p.m_position == p.m_samples && p.m_speed > 0.0f) || if ((p.m_position == p.m_samples && p.m_speed > 0.0f) ||
(p.m_position == ~0 && p.m_speed < 0.0f)) // loop or stop (p.m_position = umax && p.m_speed < 0.0f)) // loop or stop
{ {
if (p.m_loop_mode == CELL_SSPLAYER_LOOP_ON) if (p.m_loop_mode == CELL_SSPLAYER_LOOP_ON)
{ {

View File

@ -91,7 +91,7 @@ struct sce_np_trophy_manager
{ {
error = SCE_NP_TROPHY_ERROR_ABORT; error = SCE_NP_TROPHY_ERROR_ABORT;
return res; return res;
} }
return res; return res;
} }
@ -231,7 +231,7 @@ error_code sceNpTrophyTerm()
ids[it++] = id; ids[it++] = id;
}; };
// This functionality could be implemented in idm instead // This functionality could be implemented in idm instead
idm::select<trophy_handle_t>(get_handles); idm::select<trophy_handle_t>(get_handles);
while (it) while (it)
@ -662,7 +662,7 @@ error_code sceNpTrophyGetRequiredDiskSpace(u32 context, u32 handle, vm::ptr<u64>
{ {
sceNpTrophy.warning("sceNpTrophyGetRequiredDiskSpace(): Trophy config is already installed (trp_name=%s)", ctxt->trp_name); sceNpTrophy.warning("sceNpTrophyGetRequiredDiskSpace(): Trophy config is already installed (trp_name=%s)", ctxt->trp_name);
} }
sceNpTrophy.warning("sceNpTrophyGetRequiredDiskSpace(): reqspace is 0x%llx", space); sceNpTrophy.warning("sceNpTrophyGetRequiredDiskSpace(): reqspace is 0x%llx", space);
*reqspace = space; *reqspace = space;
@ -861,7 +861,7 @@ error_code sceNpTrophyUnlockTrophy(u32 context, u32 handle, s32 trophyId, vm::pt
const std::string& config_path = vfs::get("/dev_hdd0/home/" + Emu.GetUsr() + "/trophy/" + ctxt->trp_name + "/TROPCONF.SFM"); const std::string& config_path = vfs::get("/dev_hdd0/home/" + Emu.GetUsr() + "/trophy/" + ctxt->trp_name + "/TROPCONF.SFM");
const u32 unlocked_platinum_id = ctxt->tropusr->GetUnlockedPlatinumID(trophyId, config_path); const u32 unlocked_platinum_id = ctxt->tropusr->GetUnlockedPlatinumID(trophyId, config_path);
if (unlocked_platinum_id != SCE_NP_TROPHY_INVALID_TROPHY_ID) if (unlocked_platinum_id != 0u + SCE_NP_TROPHY_INVALID_TROPHY_ID)
{ {
sceNpTrophy.warning("sceNpTrophyUnlockTrophy: All requirements for unlocking the platinum trophy (ID = %d) were met.)", unlocked_platinum_id); sceNpTrophy.warning("sceNpTrophyUnlockTrophy: All requirements for unlocking the platinum trophy (ID = %d) were met.)", unlocked_platinum_id);
@ -885,7 +885,7 @@ error_code sceNpTrophyUnlockTrophy(u32 context, u32 handle, s32 trophyId, vm::pt
// Enqueue popup for the regular trophy // Enqueue popup for the regular trophy
show_trophy_notification(ctxt, trophyId); show_trophy_notification(ctxt, trophyId);
if (unlocked_platinum_id != SCE_NP_TROPHY_INVALID_TROPHY_ID) if (unlocked_platinum_id != 0u + SCE_NP_TROPHY_INVALID_TROPHY_ID)
{ {
// Enqueue popup for the holy platinum trophy // Enqueue popup for the holy platinum trophy
show_trophy_notification(ctxt, unlocked_platinum_id); show_trophy_notification(ctxt, unlocked_platinum_id);

View File

@ -77,7 +77,7 @@ error_code sys_lwcond_signal(ppu_thread& ppu, vm::ptr<sys_lwcond_t> lwcond)
lwmutex->all_info--; lwmutex->all_info--;
if (res != CELL_EPERM) if (res + 0u != CELL_EPERM)
{ {
return res; return res;
} }
@ -90,7 +90,7 @@ error_code sys_lwcond_signal(ppu_thread& ppu, vm::ptr<sys_lwcond_t> lwcond)
{ {
// if locking failed // if locking failed
if (res != CELL_EBUSY) if (res + 0u != CELL_EBUSY)
{ {
return CELL_ESRCH; return CELL_ESRCH;
} }
@ -115,7 +115,7 @@ error_code sys_lwcond_signal(ppu_thread& ppu, vm::ptr<sys_lwcond_t> lwcond)
// unlock the lightweight mutex // unlock the lightweight mutex
sys_lwmutex_unlock(ppu, lwmutex); sys_lwmutex_unlock(ppu, lwmutex);
if (res != CELL_ENOENT) if (res + 0u != CELL_ENOENT)
{ {
return res; return res;
} }
@ -164,7 +164,7 @@ error_code sys_lwcond_signal_all(ppu_thread& ppu, vm::ptr<sys_lwcond_t> lwcond)
{ {
// if locking failed // if locking failed
if (res != CELL_EBUSY) if (res + 0u != CELL_EBUSY)
{ {
return CELL_ESRCH; return CELL_ESRCH;
} }
@ -235,7 +235,7 @@ error_code sys_lwcond_signal_to(ppu_thread& ppu, vm::ptr<sys_lwcond_t> lwcond, u
{ {
// if locking failed // if locking failed
if (res != CELL_EBUSY) if (res + 0u != CELL_EBUSY)
{ {
return CELL_ESRCH; return CELL_ESRCH;
} }
@ -300,7 +300,7 @@ error_code sys_lwcond_wait(ppu_thread& ppu, vm::ptr<sys_lwcond_t> lwcond, u64 ti
return 0; return 0;
} }
if (res == CELL_OK || res == CELL_ESRCH) if (res == CELL_OK || res + 0u == CELL_ESRCH)
{ {
if (res == CELL_OK) if (res == CELL_OK)
{ {
@ -319,7 +319,7 @@ error_code sys_lwcond_wait(ppu_thread& ppu, vm::ptr<sys_lwcond_t> lwcond, u64 ti
return res; return res;
} }
if (res == CELL_EBUSY || res == CELL_ETIMEDOUT) if (res + 0u == CELL_EBUSY || res + 0u == CELL_ETIMEDOUT)
{ {
if (error_code res2 = sys_lwmutex_lock(ppu, lwmutex, 0)) if (error_code res2 = sys_lwmutex_lock(ppu, lwmutex, 0))
{ {
@ -329,7 +329,7 @@ error_code sys_lwcond_wait(ppu_thread& ppu, vm::ptr<sys_lwcond_t> lwcond, u64 ti
// if successfully locked, restore recursive value // if successfully locked, restore recursive value
lwmutex->recursive_count = recursive_value; lwmutex->recursive_count = recursive_value;
if (res == CELL_EBUSY) if (res + 0u == CELL_EBUSY)
{ {
return CELL_OK; return CELL_OK;
} }
@ -337,7 +337,7 @@ error_code sys_lwcond_wait(ppu_thread& ppu, vm::ptr<sys_lwcond_t> lwcond, u64 ti
return res; return res;
} }
if (res == CELL_EDEADLK) if (res + 0u == CELL_EDEADLK)
{ {
// restore owner and recursive value // restore owner and recursive value
const auto old = lwmutex->vars.owner.exchange(tid); const auto old = lwmutex->vars.owner.exchange(tid);

View File

@ -186,7 +186,7 @@ error_code sys_lwmutex_lock(ppu_thread& ppu, vm::ptr<sys_lwmutex_t> lwmutex, u64
return CELL_OK; return CELL_OK;
} }
if (res == CELL_EBUSY && lwmutex->attribute & SYS_SYNC_RETRY) if (res + 0u == CELL_EBUSY && lwmutex->attribute & SYS_SYNC_RETRY)
{ {
while (true) while (true)
{ {
@ -224,7 +224,7 @@ error_code sys_lwmutex_lock(ppu_thread& ppu, vm::ptr<sys_lwmutex_t> lwmutex, u64
{ {
lwmutex->vars.owner.release(tid); lwmutex->vars.owner.release(tid);
} }
else if (timeout && res_ != CELL_ETIMEDOUT) else if (timeout && res_ + 0u != CELL_ETIMEDOUT)
{ {
const u64 time_diff = get_guest_system_time() - time0; const u64 time_diff = get_guest_system_time() - time0;
@ -239,7 +239,7 @@ error_code sys_lwmutex_lock(ppu_thread& ppu, vm::ptr<sys_lwmutex_t> lwmutex, u64
lwmutex->all_info--; lwmutex->all_info--;
if (res_ != CELL_EBUSY) if (res_ + 0u != CELL_EBUSY)
{ {
return res_; return res_;
} }
@ -358,7 +358,7 @@ error_code sys_lwmutex_unlock(ppu_thread& ppu, vm::ptr<sys_lwmutex_t> lwmutex)
lwmutex->vars.owner.release(lwmutex_free); lwmutex->vars.owner.release(lwmutex_free);
// Call the alternative syscall // Call the alternative syscall
if (_sys_lwmutex_unlock2(ppu, lwmutex->sleep_queue) == CELL_ESRCH) if (_sys_lwmutex_unlock2(ppu, lwmutex->sleep_queue) + 0u == CELL_ESRCH)
{ {
return CELL_ESRCH; return CELL_ESRCH;
} }
@ -370,7 +370,7 @@ error_code sys_lwmutex_unlock(ppu_thread& ppu, vm::ptr<sys_lwmutex_t> lwmutex)
lwmutex->vars.owner.release(lwmutex_reserved); lwmutex->vars.owner.release(lwmutex_reserved);
// call the syscall // call the syscall
if (_sys_lwmutex_unlock(ppu, lwmutex->sleep_queue) == CELL_ESRCH) if (_sys_lwmutex_unlock(ppu, lwmutex->sleep_queue) + 0u == CELL_ESRCH)
{ {
return CELL_ESRCH; return CELL_ESRCH;
} }

View File

@ -69,7 +69,7 @@ s32 sys_mempool_create(ppu_thread& ppu, vm::ptr<sys_mempool_t> mempool, vm::ptr<
// TODO: check blocks alignment wrt ralignment // TODO: check blocks alignment wrt ralignment
u64 num_blocks = chunk_size / block_size; u64 num_blocks = chunk_size / block_size;
memory_pool->free_blocks.resize(num_blocks); memory_pool->free_blocks.resize(num_blocks);
for (int i = 0; i < num_blocks; ++i) for (u32 i = 0; i < num_blocks; ++i)
{ {
memory_pool->free_blocks[i] = vm::ptr<void>::make(chunk.addr() + i * block_size); memory_pool->free_blocks[i] = vm::ptr<void>::make(chunk.addr() + i * block_size);
} }

View File

@ -64,7 +64,7 @@ void ppu_module::validate(u32 reloc)
const u32 addr = func["addr"].as<u32>(-1); const u32 addr = func["addr"].as<u32>(-1);
const u32 size = func["size"].as<u32>(0); const u32 size = func["size"].as<u32>(0);
if (addr != -1 && index < funcs.size()) if (addr != umax && index < funcs.size())
{ {
u32 found = funcs[index].addr - reloc; u32 found = funcs[index].addr - reloc;
@ -567,7 +567,7 @@ void ppu_module::analyse(u32 lib_toc, u32 entry)
if (func.addr) if (func.addr)
{ {
if (toc && func.toc && func.toc != -1 && func.toc != toc) if (toc && func.toc && func.toc != umax && func.toc != toc)
{ {
func.toc = -1; func.toc = -1;
} }
@ -592,7 +592,7 @@ void ppu_module::analyse(u32 lib_toc, u32 entry)
// Register new TOC and find basic set of functions // Register new TOC and find basic set of functions
auto add_toc = [&](u32 toc) auto add_toc = [&](u32 toc)
{ {
if (!toc || toc == -1 || !TOCs.emplace(toc).second) if (!toc || toc == umax || !TOCs.emplace(toc).second)
{ {
return; return;
} }
@ -719,7 +719,7 @@ void ppu_module::analyse(u32 lib_toc, u32 entry)
// Clean TOCs // Clean TOCs
for (auto&& pair : fmap) for (auto&& pair : fmap)
{ {
if (pair.second.toc == -1) if (pair.second.toc == umax)
{ {
pair.second.toc = 0; pair.second.toc = 0;
} }
@ -842,7 +842,7 @@ void ppu_module::analyse(u32 lib_toc, u32 entry)
ppu_function& func = func_queue[i]; ppu_function& func = func_queue[i];
// Fixup TOCs // Fixup TOCs
if (func.toc && func.toc != -1) if (func.toc && func.toc != umax)
{ {
for (u32 addr : func.callers) for (u32 addr : func.callers)
{ {
@ -989,13 +989,13 @@ void ppu_module::analyse(u32 lib_toc, u32 entry)
{ {
auto& new_func = add_func(target, 0, func.addr); auto& new_func = add_func(target, 0, func.addr);
if (func.toc && func.toc != -1 && new_func.toc == 0) if (func.toc && func.toc != umax && new_func.toc == 0)
{ {
const u32 toc = func.toc + toc_add; const u32 toc = func.toc + toc_add;
add_toc(toc); add_toc(toc);
add_func(new_func.addr, toc, 0); add_func(new_func.addr, toc, 0);
} }
else if (new_func.toc && new_func.toc != -1 && func.toc == 0) else if (new_func.toc && new_func.toc != umax && func.toc == 0)
{ {
const u32 toc = new_func.toc - toc_add; const u32 toc = new_func.toc - toc_add;
add_toc(toc); add_toc(toc);
@ -1036,13 +1036,13 @@ void ppu_module::analyse(u32 lib_toc, u32 entry)
{ {
auto& new_func = add_func(target, 0, func.addr); auto& new_func = add_func(target, 0, func.addr);
if (func.toc && func.toc != -1 && new_func.toc == 0) if (func.toc && func.toc != umax && new_func.toc == 0)
{ {
const u32 toc = func.toc + toc_add; const u32 toc = func.toc + toc_add;
add_toc(toc); add_toc(toc);
add_func(new_func.addr, toc, 0); add_func(new_func.addr, toc, 0);
} }
else if (new_func.toc && new_func.toc != -1 && func.toc == 0) else if (new_func.toc && new_func.toc != umax && func.toc == 0)
{ {
const u32 toc = new_func.toc - toc_add; const u32 toc = new_func.toc - toc_add;
add_toc(toc); add_toc(toc);
@ -2262,7 +2262,7 @@ void ppu_acontext::RLWIMI(ppu_opcode_t op)
max = utils::rol64(static_cast<u32>(max) | max << 32, op.sh32) & mask; max = utils::rol64(static_cast<u32>(max) | max << 32, op.sh32) & mask;
} }
if (mask != -1) if (mask != umax)
{ {
// Insertion // Insertion
min |= gpr[op.ra].bmin & ~mask; min |= gpr[op.ra].bmin & ~mask;
@ -2484,7 +2484,7 @@ void ppu_acontext::RLDIMI(ppu_opcode_t op)
min = utils::rol64(min, sh) & mask; min = utils::rol64(min, sh) & mask;
max = utils::rol64(max, sh) & mask; max = utils::rol64(max, sh) & mask;
if (mask != -1) if (mask != umax)
{ {
// Insertion // Insertion
min |= gpr[op.ra].bmin & ~mask; min |= gpr[op.ra].bmin & ~mask;

View File

@ -1029,7 +1029,7 @@ struct ppu_acontext
const u64 bdiv = rhs.div(); const u64 bdiv = rhs.div();
// Check overflow, generate normalized range // Check overflow, generate normalized range
if (adiv != -1 && bdiv != -1 && adiv <= adiv + bdiv) if (adiv != umax && bdiv != umax && adiv <= adiv + bdiv)
{ {
r = range(imin + rhs.imin, imax + rhs.imax); r = range(imin + rhs.imin, imax + rhs.imax);
} }

View File

@ -4251,7 +4251,7 @@ bool ppu_interpreter::SRAW(ppu_thread& ppu, ppu_opcode_t op)
else else
{ {
ppu.gpr[op.ra] = RS >> shift; ppu.gpr[op.ra] = RS >> shift;
ppu.xer.ca = (RS < 0) && ((ppu.gpr[op.ra] << shift) != RS); ppu.xer.ca = (RS < 0) && ((ppu.gpr[op.ra] << shift) != static_cast<u64>(RS));
} }
if (op.rc) [[unlikely]] ppu_cr_set<s64>(ppu, 0, ppu.gpr[op.ra], 0); if (op.rc) [[unlikely]] ppu_cr_set<s64>(ppu, 0, ppu.gpr[op.ra], 0);
@ -4270,7 +4270,7 @@ bool ppu_interpreter::SRAD(ppu_thread& ppu, ppu_opcode_t op)
else else
{ {
ppu.gpr[op.ra] = RS >> shift; ppu.gpr[op.ra] = RS >> shift;
ppu.xer.ca = (RS < 0) && ((ppu.gpr[op.ra] << shift) != RS); ppu.xer.ca = (RS < 0) && ((ppu.gpr[op.ra] << shift) != static_cast<u64>(RS));
} }
if (op.rc) [[unlikely]] ppu_cr_set<s64>(ppu, 0, ppu.gpr[op.ra], 0); if (op.rc) [[unlikely]] ppu_cr_set<s64>(ppu, 0, ppu.gpr[op.ra], 0);
@ -4296,7 +4296,7 @@ bool ppu_interpreter::SRAWI(ppu_thread& ppu, ppu_opcode_t op)
{ {
s32 RS = static_cast<u32>(ppu.gpr[op.rs]); s32 RS = static_cast<u32>(ppu.gpr[op.rs]);
ppu.gpr[op.ra] = RS >> op.sh32; ppu.gpr[op.ra] = RS >> op.sh32;
ppu.xer.ca = (RS < 0) && (static_cast<u32>(ppu.gpr[op.ra] << op.sh32) != RS); ppu.xer.ca = (RS < 0) && (static_cast<u32>(ppu.gpr[op.ra] << op.sh32) != static_cast<u32>(RS));
if (op.rc) [[unlikely]] ppu_cr_set<s64>(ppu, 0, ppu.gpr[op.ra], 0); if (op.rc) [[unlikely]] ppu_cr_set<s64>(ppu, 0, ppu.gpr[op.ra], 0);
return true; return true;
@ -4307,7 +4307,7 @@ bool ppu_interpreter::SRADI(ppu_thread& ppu, ppu_opcode_t op)
auto sh = op.sh64; auto sh = op.sh64;
s64 RS = ppu.gpr[op.rs]; s64 RS = ppu.gpr[op.rs];
ppu.gpr[op.ra] = RS >> sh; ppu.gpr[op.ra] = RS >> sh;
ppu.xer.ca = (RS < 0) && ((ppu.gpr[op.ra] << sh) != RS); ppu.xer.ca = (RS < 0) && ((ppu.gpr[op.ra] << sh) != static_cast<u64>(RS));
if (op.rc) [[unlikely]] ppu_cr_set<s64>(ppu, 0, ppu.gpr[op.ra], 0); if (op.rc) [[unlikely]] ppu_cr_set<s64>(ppu, 0, ppu.gpr[op.ra], 0);
return true; return true;

View File

@ -800,7 +800,7 @@ std::shared_ptr<lv2_prx> ppu_load_prx(const ppu_prx_object& elf, const std::stri
if (s.sh_type == 1u && addr && size) // TODO: some sections with addr=0 are valid if (s.sh_type == 1u && addr && size) // TODO: some sections with addr=0 are valid
{ {
for (auto i = 0; i < prx->segs.size(); i++) for (std::size_t i = 0; i < prx->segs.size(); i++)
{ {
const u32 saddr = static_cast<u32>(elf.progs[i].p_vaddr); const u32 saddr = static_cast<u32>(elf.progs[i].p_vaddr);
if (addr >= saddr && addr < saddr + elf.progs[i].p_memsz) if (addr >= saddr && addr < saddr + elf.progs[i].p_memsz)
@ -1742,7 +1742,7 @@ std::shared_ptr<lv2_overlay> ppu_load_overlay(const ppu_exec_object& elf, const
ppu_loader.warning("Bad process_param size! [0x%x : 0x%x]", info.size, u32{sizeof(process_param_t)}); ppu_loader.warning("Bad process_param size! [0x%x : 0x%x]", info.size, u32{sizeof(process_param_t)});
} }
if (info.magic != "OVLM"_u32) //string "OVLM" if (info.magic != 0x4f564c4du) //string "OVLM"
{ {
ppu_loader.error("Bad process_param magic! [0x%x]", info.magic); ppu_loader.error("Bad process_param magic! [0x%x]", info.magic);
} }

View File

@ -1338,7 +1338,7 @@ extern void ppu_initialize(const ppu_module& info)
ppu_register_function_at(block.first, block.second, nullptr); ppu_register_function_at(block.first, block.second, nullptr);
} }
if (g_cfg.core.ppu_debug && func.size && func.toc != -1) if (g_cfg.core.ppu_debug && func.size && func.toc != umax)
{ {
s_ppu_toc->emplace(func.addr, func.toc); s_ppu_toc->emplace(func.addr, func.toc);
ppu_ref<u32>(func.addr) = ::narrow<u32>(reinterpret_cast<std::uintptr_t>(&ppu_check_toc)); ppu_ref<u32>(func.addr) = ::narrow<u32>(reinterpret_cast<std::uintptr_t>(&ppu_check_toc));

View File

@ -260,7 +260,7 @@ void PPUTranslator::CallFunction(u64 target, Value* indirect)
if (!indirect) if (!indirect)
{ {
if ((!m_reloc && target < 0x10000) || target >= -0x10000) if ((!m_reloc && target < 0x10000) || target >= u64{} - 0x10000)
{ {
Trap(); Trap();
return; return;
@ -1943,7 +1943,7 @@ void PPUTranslator::RLWIMI(ppu_opcode_t op)
result = m_ir->CreateAnd(RotateLeft(DuplicateExt(GetGpr(op.rs, 32)), op.sh32), mask); result = m_ir->CreateAnd(RotateLeft(DuplicateExt(GetGpr(op.rs, 32)), op.sh32), mask);
} }
if (mask != -1) if (mask != umax)
{ {
// Insertion // Insertion
result = m_ir->CreateOr(result, m_ir->CreateAnd(GetGpr(op.ra), ~mask)); result = m_ir->CreateOr(result, m_ir->CreateAnd(GetGpr(op.ra), ~mask));
@ -2193,7 +2193,7 @@ void PPUTranslator::RLDIMI(ppu_opcode_t op)
result = m_ir->CreateAnd(RotateLeft(GetGpr(op.rs), sh), mask); result = m_ir->CreateAnd(RotateLeft(GetGpr(op.rs), sh), mask);
} }
if (mask != -1) if (mask != umax)
{ {
// Insertion // Insertion
result = m_ir->CreateOr(result, m_ir->CreateAnd(GetGpr(op.ra), ~mask)); result = m_ir->CreateOr(result, m_ir->CreateAnd(GetGpr(op.ra), ~mask));
@ -2303,7 +2303,7 @@ void PPUTranslator::MFOCRF(ppu_opcode_t op)
const u64 pos = countLeadingZeros<u32>(op.crm, ZB_Width) - 24; const u64 pos = countLeadingZeros<u32>(op.crm, ZB_Width) - 24;
if (pos >= 8 || 0x80 >> pos != op.crm) if (pos >= 8 || 0x80u >> pos != op.crm)
{ {
CompilationError("MFOCRF: Undefined behaviour"); CompilationError("MFOCRF: Undefined behaviour");
SetGpr(op.rd, UndefValue::get(GetType<u64>())); SetGpr(op.rd, UndefValue::get(GetType<u64>()));
@ -2565,7 +2565,7 @@ void PPUTranslator::MTOCRF(ppu_opcode_t op)
// MTOCRF // MTOCRF
const u64 pos = countLeadingZeros<u32>(op.crm, ZB_Width) - 24; const u64 pos = countLeadingZeros<u32>(op.crm, ZB_Width) - 24;
if (pos >= 8 || 128 >> pos != op.crm) if (pos >= 8 || 0x80u >> pos != op.crm)
{ {
CompilationError("MTOCRF: Undefined behaviour"); CompilationError("MTOCRF: Undefined behaviour");
return; return;

View File

@ -304,7 +304,7 @@ spu_function_t spu_recompiler::compile(spu_program&& _func)
continue; continue;
} }
const bool first = ls_off == -8192; const bool first = ls_off == u32{} - 8192;
// Ensure small distance for disp8*N // Ensure small distance for disp8*N
if (j - ls_off >= 8192) if (j - ls_off >= 8192)
@ -429,7 +429,7 @@ spu_function_t spu_recompiler::compile(spu_program&& _func)
continue; continue;
} }
const bool first = ls_off == -4096; const bool first = ls_off == u32{0} - 4096;
// Ensure small distance for disp8*N // Ensure small distance for disp8*N
if (j - ls_off >= 4096) if (j - ls_off >= 4096)

View File

@ -80,7 +80,7 @@ static FORCE_INLINE rsx::thread* get_rsx_if_needs_res_pause(u32 addr)
ASSUME(render); ASSUME(render);
if (render->iomap_table.io[addr >> 20] == -1) [[likely]] if (render->iomap_table.io[addr >> 20].load() == umax) [[likely]]
{ {
return {}; return {};
} }

View File

@ -30,7 +30,7 @@ bool lv2_event_queue::send(lv2_event event)
if (sq.empty()) if (sq.empty())
{ {
if (events.size() < this->size) if (events.size() < this->size + 0u)
{ {
// Save event // Save event
events.emplace_back(event); events.emplace_back(event);

View File

@ -258,7 +258,7 @@ error_code sys_fs_open(ppu_thread& ppu, vm::cptr<char> path, s32 flags, vm::ptr<
const auto mp = lv2_fs_object::get_mp(vpath); const auto mp = lv2_fs_object::get_mp(vpath);
if (vpath.find_first_not_of('/') == -1) if (vpath.find_first_not_of('/') == umax)
{ {
return {CELL_EISDIR, path}; return {CELL_EISDIR, path};
} }
@ -764,7 +764,7 @@ error_code sys_fs_stat(ppu_thread& ppu, vm::cptr<char> path, vm::ptr<CellFsStat>
const auto mp = lv2_fs_object::get_mp(vpath); const auto mp = lv2_fs_object::get_mp(vpath);
if (vpath.find_first_not_of('/') == -1) if (vpath.find_first_not_of('/') == umax)
{ {
*sb = {CELL_FS_S_IFDIR | 0444}; *sb = {CELL_FS_S_IFDIR | 0444};
return CELL_OK; return CELL_OK;
@ -898,7 +898,7 @@ error_code sys_fs_mkdir(ppu_thread& ppu, vm::cptr<char> path, s32 mode)
const std::string_view vpath = path.get_ptr(); const std::string_view vpath = path.get_ptr();
const std::string local_path = vfs::get(vpath); const std::string local_path = vfs::get(vpath);
if (vpath.find_first_not_of('/') == -1) if (vpath.find_first_not_of('/') == umax)
{ {
return {CELL_EEXIST, path}; return {CELL_EEXIST, path};
} }
@ -945,7 +945,7 @@ error_code sys_fs_rename(ppu_thread& ppu, vm::cptr<char> from, vm::cptr<char> to
const std::string_view vto = to.get_ptr(); const std::string_view vto = to.get_ptr();
const std::string local_to = vfs::get(vto); const std::string local_to = vfs::get(vto);
if (vfrom.find_first_not_of('/') == -1 || vto.find_first_not_of('/') == -1) if (vfrom.find_first_not_of('/') == umax || vto.find_first_not_of('/') == umax)
{ {
return CELL_EPERM; return CELL_EPERM;
} }
@ -1000,7 +1000,7 @@ error_code sys_fs_rmdir(ppu_thread& ppu, vm::cptr<char> path)
const std::string_view vpath = path.get_ptr(); const std::string_view vpath = path.get_ptr();
const std::string local_path = vfs::get(vpath); const std::string local_path = vfs::get(vpath);
if (vpath.find_first_not_of('/') == -1) if (vpath.find_first_not_of('/') == umax)
{ {
return {CELL_EPERM, path}; return {CELL_EPERM, path};
} }
@ -1052,7 +1052,7 @@ error_code sys_fs_unlink(ppu_thread& ppu, vm::cptr<char> path)
const std::size_t dev_start = vpath.find_first_not_of('/'); const std::size_t dev_start = vpath.find_first_not_of('/');
if (dev_start == -1) if (dev_start == umax)
{ {
return {CELL_EISDIR, path}; return {CELL_EISDIR, path};
} }
@ -1540,7 +1540,7 @@ error_code sys_fs_lseek(ppu_thread& ppu, u32 fd, s64 offset, s32 whence, vm::ptr
const u64 result = file->file.seek(offset, static_cast<fs::seek_mode>(whence)); const u64 result = file->file.seek(offset, static_cast<fs::seek_mode>(whence));
if (result == -1) if (result == umax)
{ {
switch (auto error = fs::g_tls_error) switch (auto error = fs::g_tls_error)
{ {
@ -1624,7 +1624,7 @@ error_code sys_fs_get_block_size(ppu_thread& ppu, vm::cptr<char> path, vm::ptr<u
const std::string_view vpath = path.get_ptr(); const std::string_view vpath = path.get_ptr();
const std::string local_path = vfs::get(vpath); const std::string local_path = vfs::get(vpath);
if (vpath.find_first_not_of('/') == -1) if (vpath.find_first_not_of('/') == umax)
{ {
return {CELL_EISDIR, path}; return {CELL_EISDIR, path};
} }
@ -1672,7 +1672,7 @@ error_code sys_fs_truncate(ppu_thread& ppu, vm::cptr<char> path, u64 size)
const std::string_view vpath = path.get_ptr(); const std::string_view vpath = path.get_ptr();
const std::string local_path = vfs::get(vpath); const std::string local_path = vfs::get(vpath);
if (vpath.find_first_not_of('/') == -1) if (vpath.find_first_not_of('/') == umax)
{ {
return {CELL_EISDIR, path}; return {CELL_EISDIR, path};
} }
@ -1858,7 +1858,7 @@ error_code sys_fs_utime(ppu_thread& ppu, vm::cptr<char> path, vm::cptr<CellFsUti
const std::string_view vpath = path.get_ptr(); const std::string_view vpath = path.get_ptr();
const std::string local_path = vfs::get(vpath); const std::string local_path = vfs::get(vpath);
if (vpath.find_first_not_of('/') == -1) if (vpath.find_first_not_of('/') == umax)
{ {
return {CELL_EISDIR, path}; return {CELL_EISDIR, path};
} }

View File

@ -87,7 +87,7 @@ error_code _sys_lwcond_signal(ppu_thread& ppu, u32 lwcond_id, u32 lwmutex_id, u3
const auto cond = idm::check<lv2_obj, lv2_lwcond>(lwcond_id, [&](lv2_lwcond& cond) -> int const auto cond = idm::check<lv2_obj, lv2_lwcond>(lwcond_id, [&](lv2_lwcond& cond) -> int
{ {
if (ppu_thread_id != -1 && !idm::check_unlocked<named_thread<ppu_thread>>(ppu_thread_id)) if (ppu_thread_id != umax && !idm::check_unlocked<named_thread<ppu_thread>>(ppu_thread_id))
{ {
return -1; return -1;
} }
@ -110,7 +110,7 @@ error_code _sys_lwcond_signal(ppu_thread& ppu, u32 lwcond_id, u32 lwmutex_id, u3
cpu_thread* result = nullptr; cpu_thread* result = nullptr;
if (ppu_thread_id != -1) if (ppu_thread_id != umax)
{ {
for (auto cpu : cond.sq) for (auto cpu : cond.sq)
{ {
@ -161,7 +161,7 @@ error_code _sys_lwcond_signal(ppu_thread& ppu, u32 lwcond_id, u32 lwmutex_id, u3
if (!cond.ret) if (!cond.ret)
{ {
if (ppu_thread_id == -1) if (ppu_thread_id == umax)
{ {
if (mode == 3) if (mode == 3)
{ {

View File

@ -708,8 +708,9 @@ error_code sys_mmapper_enable_page_fault_notification(ppu_thread& ppu, u32 start
error_code res = sys_event_port_create(port_id, SYS_EVENT_PORT_LOCAL, SYS_MEMORY_PAGE_FAULT_EVENT_KEY); error_code res = sys_event_port_create(port_id, SYS_EVENT_PORT_LOCAL, SYS_MEMORY_PAGE_FAULT_EVENT_KEY);
sys_event_port_connect_local(*port_id, event_queue_id); sys_event_port_connect_local(*port_id, event_queue_id);
if (res == CELL_EAGAIN) if (res + 0u == CELL_EAGAIN)
{ // Not enough system resources. {
// Not enough system resources.
return CELL_EAGAIN; return CELL_EAGAIN;
} }

View File

@ -443,7 +443,7 @@ error_code sys_net_bnet_accept(ppu_thread& ppu, s32 s, vm::ptr<sys_net_sockaddr>
return -sys_net_error{result}; return -sys_net_error{result};
} }
if (ppu.gpr[3] == -SYS_NET_EINTR) if (ppu.gpr[3] == static_cast<u64>(-SYS_NET_EINTR))
{ {
return -SYS_NET_EINTR; return -SYS_NET_EINTR;
} }
@ -679,7 +679,7 @@ error_code sys_net_bnet_connect(ppu_thread& ppu, s32 s, vm::ptr<sys_net_sockaddr
return -sys_net_error{result}; return -sys_net_error{result};
} }
if (ppu.gpr[3] == -SYS_NET_EINTR) if (ppu.gpr[3] == static_cast<u64>(-SYS_NET_EINTR))
{ {
return -SYS_NET_EINTR; return -SYS_NET_EINTR;
} }
@ -1113,7 +1113,7 @@ error_code sys_net_bnet_recvfrom(ppu_thread& ppu, s32 s, vm::ptr<void> buf, u32
return -result; return -result;
} }
if (ppu.gpr[3] == -SYS_NET_EINTR) if (ppu.gpr[3] == static_cast<u64>(-SYS_NET_EINTR))
{ {
return -SYS_NET_EINTR; return -SYS_NET_EINTR;
} }
@ -1283,7 +1283,7 @@ error_code sys_net_bnet_sendto(ppu_thread& ppu, s32 s, vm::cptr<void> buf, u32 l
return -result; return -result;
} }
if (ppu.gpr[3] == -SYS_NET_EINTR) if (ppu.gpr[3] == static_cast<u64>(-SYS_NET_EINTR))
{ {
return -SYS_NET_EINTR; return -SYS_NET_EINTR;
} }

View File

@ -30,7 +30,7 @@ void _sys_ppu_thread_exit(ppu_thread& ppu, u64 errorcode)
// Joinable, not joined // Joinable, not joined
value = -3; value = -3;
} }
else if (value != -1) else if (value != umax)
{ {
// Joinable, joined // Joinable, joined
value = -2; value = -2;
@ -39,7 +39,7 @@ void _sys_ppu_thread_exit(ppu_thread& ppu, u64 errorcode)
// Detached otherwise // Detached otherwise
}); });
if (jid == -1) if (jid == umax)
{ {
// Detach detached thread, id will be removed on cleanup // Detach detached thread, id will be removed on cleanup
static_cast<named_thread<ppu_thread>&>(ppu) = thread_state::detached; static_cast<named_thread<ppu_thread>&>(ppu) = thread_state::detached;
@ -76,13 +76,13 @@ error_code sys_ppu_thread_join(ppu_thread& ppu, u32 thread_id, vm::ptr<u64> vptr
{ {
CellError result = thread.joiner.atomic_op([&](u32& value) -> CellError CellError result = thread.joiner.atomic_op([&](u32& value) -> CellError
{ {
if (value == -3) if (value == 0u - 3)
{ {
value = -2; value = -2;
return CELL_EBUSY; return CELL_EBUSY;
} }
if (value == -2) if (value == 0u - 2)
{ {
return CELL_ESRCH; return CELL_ESRCH;
} }
@ -149,18 +149,18 @@ error_code sys_ppu_thread_detach(u32 thread_id)
{ {
return thread.joiner.atomic_op([&](u32& value) -> CellError return thread.joiner.atomic_op([&](u32& value) -> CellError
{ {
if (value == -3) if (value == 0u - 3)
{ {
value = -2; value = -2;
return CELL_EAGAIN; return CELL_EAGAIN;
} }
if (value == -2) if (value == 0u - 2)
{ {
return CELL_ESRCH; return CELL_ESRCH;
} }
if (value == -1) if (value == umax)
{ {
return CELL_EINVAL; return CELL_EINVAL;
} }
@ -202,7 +202,7 @@ error_code sys_ppu_thread_get_join_state(ppu_thread& ppu, vm::ptr<s32> isjoinabl
return CELL_EFAULT; return CELL_EFAULT;
} }
*isjoinable = ppu.joiner != -1; *isjoinable = ppu.joiner != umax;
return CELL_OK; return CELL_OK;
} }

View File

@ -69,7 +69,7 @@ error_code sys_ss_access_control_engine(u64 pkg_id, u64 a2, u64 a3)
{ {
sys_ss.todo("sys_ss_access_control_engine(pkg_id=0x%llx, a2=0x%llx, a3=0x%llx)", pkg_id, a2, a3); sys_ss.todo("sys_ss_access_control_engine(pkg_id=0x%llx, a2=0x%llx, a3=0x%llx)", pkg_id, a2, a3);
const u64 authid = g_ps3_process_info.self_info.valid ? const u64 authid = g_ps3_process_info.self_info.valid ?
g_ps3_process_info.self_info.app_info.authid : 0; g_ps3_process_info.self_info.app_info.authid : 0;
switch (pkg_id) switch (pkg_id)
@ -86,7 +86,7 @@ error_code sys_ss_access_control_engine(u64 pkg_id, u64 a2, u64 a3)
return CELL_ESRCH; return CELL_ESRCH;
} }
verify(HERE), a2 == process_getpid(); verify(HERE), a2 == static_cast<u64>(process_getpid());
vm::write64(vm::cast(a3), authid); vm::write64(vm::cast(a3), authid);
break; break;
} }

View File

@ -358,7 +358,8 @@ void gdb_thread::send_cmd(const std::string& cmd)
std::string buf; std::string buf;
buf.reserve(cmd.length() + 4); buf.reserve(cmd.length() + 4);
buf += "$"; buf += "$";
for (int i = 0; i < cmd.length(); ++i) { for (std::size_t i = 0; i < cmd.length(); ++i)
{
checksum = (checksum + append_encoded_char(cmd[i], buf)) % 256; checksum = (checksum + append_encoded_char(cmd[i], buf)) % 256;
} }
buf += "#"; buf += "#";

View File

@ -300,7 +300,7 @@ void PadHandlerBase::init_configs()
{ {
int index = 0; int index = 0;
for (int i = 0; i < MAX_GAMEPADS; i++) for (u32 i = 0; i < MAX_GAMEPADS; i++)
{ {
if (g_cfg_input.player[i]->handler == m_type) if (g_cfg_input.player[i]->handler == m_type)
{ {

View File

@ -546,7 +546,7 @@ public:
if (I == m_fragment_shader_cache.end()) if (I == m_fragment_shader_cache.end())
return; return;
verify(HERE), (dst_buffer.size_bytes() >= ::narrow<int>(I->second.FragmentConstantOffsetCache.size()) * 16); verify(HERE), (dst_buffer.size_bytes() >= ::narrow<int>(I->second.FragmentConstantOffsetCache.size()) * 16u);
f32* dst = dst_buffer.data(); f32* dst = dst_buffer.data();
alignas(16) f32 tmp[4]; alignas(16) f32 tmp[4];

View File

@ -226,7 +226,7 @@ public:
{ {
std::unordered_map<char, char> swizzle; std::unordered_map<char, char> swizzle;
static std::unordered_map<int, char> pos_to_swizzle = static std::unordered_map<uint, char> pos_to_swizzle =
{ {
{ 0, 'x' }, { 0, 'x' },
{ 1, 'y' }, { 1, 'y' },
@ -234,18 +234,18 @@ public:
{ 3, 'w' } { 3, 'w' }
}; };
for (auto &i : pos_to_swizzle) for (auto& p : pos_to_swizzle)
{ {
swizzle[i.second] = swizzles[0].length() > i.first ? swizzles[0][i.first] : 0; swizzle[p.second] = swizzles[0].length() > p.first ? swizzles[0][p.first] : 0;
} }
for (int i = 1; i < swizzles.size(); ++i) for (uint i = 1; i < swizzles.size(); ++i)
{ {
std::unordered_map<char, char> new_swizzle; std::unordered_map<char, char> new_swizzle;
for (auto &sw : pos_to_swizzle) for (auto& p : pos_to_swizzle)
{ {
new_swizzle[sw.second] = swizzle[swizzles[i].length() <= sw.first ? '\0' : swizzles[i][sw.first]]; new_swizzle[p.second] = swizzle[swizzles[i].length() <= p.first ? '\0' : swizzles[i][p.first]];
} }
swizzle = new_swizzle; swizzle = new_swizzle;
@ -254,10 +254,10 @@ public:
swizzles.clear(); swizzles.clear();
std::string new_swizzle; std::string new_swizzle;
for (auto &i : pos_to_swizzle) for (auto& p : pos_to_swizzle)
{ {
if (swizzle[i.second] != '\0') if (swizzle[p.second] != '\0')
new_swizzle += swizzle[i.second]; new_swizzle += swizzle[p.second];
} }
swizzles.push_back(new_swizzle); swizzles.push_back(new_swizzle);

View File

@ -367,7 +367,7 @@ namespace rsx
{0, size_y}, {0, size_y},
}; };
for (int n = 0; n < memory_tag_samples.size(); ++n) for (uint n = 0; n < memory_tag_samples.size(); ++n)
{ {
const auto sample_offset = (samples[n].y * rsx_pitch) + samples[n].x; const auto sample_offset = (samples[n].y * rsx_pitch) + samples[n].x;
memory_tag_samples[n].first = (sample_offset + base_addr); memory_tag_samples[n].first = (sample_offset + base_addr);

View File

@ -106,7 +106,7 @@ void GLFragmentDecompilerThread::insertOutputs(std::stringstream & OS)
const bool float_type = (m_ctrl & CELL_GCM_SHADER_CONTROL_32_BITS_EXPORTS) || !device_props.has_native_half_support; const bool float_type = (m_ctrl & CELL_GCM_SHADER_CONTROL_32_BITS_EXPORTS) || !device_props.has_native_half_support;
const auto reg_type = float_type ? "vec4" : getHalfTypeName(4); const auto reg_type = float_type ? "vec4" : getHalfTypeName(4);
for (int i = 0; i < std::size(table); ++i) for (uint i = 0; i < std::size(table); ++i)
{ {
if (m_parr.HasParam(PF_PARAM_NONE, reg_type, table[i].second)) if (m_parr.HasParam(PF_PARAM_NONE, reg_type, table[i].second))
OS << "layout(location=" << i << ") out vec4 " << table[i].first << ";\n"; OS << "layout(location=" << i << ") out vec4 " << table[i].first << ";\n";

View File

@ -2206,7 +2206,7 @@ public:
{ {
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &m_last_binding); glGetIntegerv(GL_FRAMEBUFFER_BINDING, &m_last_binding);
if (m_last_binding != new_binding.id()) if (m_last_binding + 0u != new_binding.id())
new_binding.bind(); new_binding.bind();
else else
reset = false; reset = false;

View File

@ -297,7 +297,7 @@ namespace rsx
else else
progress_2.inc(value); progress_2.inc(value);
if (index == taskbar_index || taskbar_index == -1) if (index == static_cast<u32>(taskbar_index) || taskbar_index == -1)
Emu.GetCallbacks().handle_taskbar_progress(1, static_cast<s32>(value)); Emu.GetCallbacks().handle_taskbar_progress(1, static_cast<s32>(value));
return CELL_OK; return CELL_OK;
@ -328,7 +328,7 @@ namespace rsx
else else
progress_2.set_limit(static_cast<f32>(limit)); progress_2.set_limit(static_cast<f32>(limit));
if (index == taskbar_index) if (index == static_cast<u32>(taskbar_index))
{ {
taskbar_limit = limit; taskbar_limit = limit;
Emu.GetCallbacks().handle_taskbar_progress(2, taskbar_limit); Emu.GetCallbacks().handle_taskbar_progress(2, taskbar_limit);

View File

@ -251,7 +251,7 @@ namespace rsx
if (auto err = run_input_loop()) if (auto err = run_input_loop())
return err; return err;
if (return_code == entries.size() && !newpos_head) if (return_code + 0u == entries.size() && !newpos_head)
return selection_code::new_save; return selection_code::new_save;
if (return_code >= 0 && newpos_head) if (return_code >= 0 && newpos_head)
return return_code - 1; return return_code - 1;

View File

@ -160,7 +160,7 @@ namespace rsx
// Validate the args ptr if the command attempts to read from it // Validate the args ptr if the command attempts to read from it
m_args_ptr = m_iotable->get_addr(m_internal_get + 4); m_args_ptr = m_iotable->get_addr(m_internal_get + 4);
if (m_args_ptr == -1) [[unlikely]] if (m_args_ptr == umax) [[unlikely]]
{ {
// Optional recovery // Optional recovery
data.reg = FIFO_ERROR; data.reg = FIFO_ERROR;

View File

@ -1023,7 +1023,7 @@ namespace rsx
// NOTE: surface_target_a is index 1 but is not MRT since only one surface is active // NOTE: surface_target_a is index 1 but is not MRT since only one surface is active
bool color_write_enabled = false; bool color_write_enabled = false;
for (int i = 0; i < mrt_buffers.size(); ++i) for (uint i = 0; i < mrt_buffers.size(); ++i)
{ {
if (rsx::method_registers.color_write_enabled(i)) if (rsx::method_registers.color_write_enabled(i))
{ {
@ -3089,7 +3089,7 @@ namespace rsx
if (!sync_address) if (!sync_address)
{ {
if (hint || ptimer->async_tasks_pending >= max_safe_queue_depth) if (hint || ptimer->async_tasks_pending + 0u >= max_safe_queue_depth)
{ {
// Prepare the whole queue for reading. This happens when zcull activity is disabled or queue is too long // Prepare the whole queue for reading. This happens when zcull activity is disabled or queue is too long
for (auto It = m_pending_writes.rbegin(); It != m_pending_writes.rend(); ++It) for (auto It = m_pending_writes.rbegin(); It != m_pending_writes.rend(); ++It)

View File

@ -102,7 +102,7 @@ void VKFragmentDecompilerThread::insertOutputs(std::stringstream & OS)
u8 output_index = 0; u8 output_index = 0;
const bool float_type = (m_ctrl & CELL_GCM_SHADER_CONTROL_32_BITS_EXPORTS) || !device_props.has_native_half_support; const bool float_type = (m_ctrl & CELL_GCM_SHADER_CONTROL_32_BITS_EXPORTS) || !device_props.has_native_half_support;
const auto reg_type = float_type ? "vec4" : getHalfTypeName(4); const auto reg_type = float_type ? "vec4" : getHalfTypeName(4);
for (int i = 0; i < std::size(table); ++i) for (uint i = 0; i < std::size(table); ++i)
{ {
if (m_parr.HasParam(PF_PARAM_NONE, reg_type, table[i].second)) if (m_parr.HasParam(PF_PARAM_NONE, reg_type, table[i].second))
{ {

View File

@ -2342,7 +2342,7 @@ bool VKGSRender::load_program()
if (rsx::method_registers.cull_face_enabled()) if (rsx::method_registers.cull_face_enabled())
properties.state.enable_cull_face(vk::get_cull_face(rsx::method_registers.cull_face_mode())); properties.state.enable_cull_face(vk::get_cull_face(rsx::method_registers.cull_face_mode()));
for (int index = 0; index < m_draw_buffers.size(); ++index) for (uint index = 0; index < m_draw_buffers.size(); ++index)
{ {
bool color_mask_b = rsx::method_registers.color_mask_b(index); bool color_mask_b = rsx::method_registers.color_mask_b(index);
bool color_mask_g = rsx::method_registers.color_mask_g(index); bool color_mask_g = rsx::method_registers.color_mask_g(index);

View File

@ -1827,7 +1827,7 @@ private:
if (fbo_images.size() != attachments.size()) if (fbo_images.size() != attachments.size())
return false; return false;
for (int n = 0; n < fbo_images.size(); ++n) for (uint n = 0; n < fbo_images.size(); ++n)
{ {
if (attachments[n]->info.image != fbo_images[n]->value || if (attachments[n]->info.image != fbo_images[n]->value ||
attachments[n]->info.format != fbo_images[n]->info.format) attachments[n]->info.format != fbo_images[n]->info.format)

View File

@ -288,7 +288,7 @@ namespace vk
program->bind_uniform({ m_ubo.heap->value, m_ubo_offset, std::max(m_ubo_length, 4u) }, 0, m_descriptor_set); program->bind_uniform({ m_ubo.heap->value, m_ubo_offset, std::max(m_ubo_length, 4u) }, 0, m_descriptor_set);
for (int n = 0; n < src.size(); ++n) for (uint n = 0; n < src.size(); ++n)
{ {
VkDescriptorImageInfo info = { m_sampler->value, src[n]->value, src[n]->image()->current_layout }; VkDescriptorImageInfo info = { m_sampler->value, src[n]->value, src[n]->image()->current_layout };
program->bind_uniform(info, "fs" + std::to_string(n), VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, m_descriptor_set); program->bind_uniform(info, "fs" + std::to_string(n), VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, m_descriptor_set);

View File

@ -349,8 +349,8 @@ void VKGSRender::flip(const rsx::display_flip_info_t& info)
// Check swapchain condition/status // Check swapchain condition/status
if (!m_swapchain->supports_automatic_wm_reports()) if (!m_swapchain->supports_automatic_wm_reports())
{ {
if (m_swapchain_dims.width != m_frame->client_width() || if (m_swapchain_dims.width != m_frame->client_width() + 0u ||
m_swapchain_dims.height != m_frame->client_height()) m_swapchain_dims.height != m_frame->client_height() + 0u)
{ {
swapchain_unavailable = true; swapchain_unavailable = true;
} }

View File

@ -357,7 +357,7 @@ namespace vk
vkCmdBeginRenderPass(cmd, &rp_begin, VK_SUBPASS_CONTENTS_INLINE); vkCmdBeginRenderPass(cmd, &rp_begin, VK_SUBPASS_CONTENTS_INLINE);
for (int i = 0; i < counts.size(); ++i) for (uint i = 0; i < counts.size(); ++i)
{ {
vkCmdDraw(cmd, counts[i], 1, offsets[i], i); vkCmdDraw(cmd, counts[i], 1, offsets[i], i);
} }

View File

@ -217,7 +217,7 @@ namespace rsx
const u32 addr = rsx->iomap_table.get_addr(0xf100000 + (index * 0x40)); const u32 addr = rsx->iomap_table.get_addr(0xf100000 + (index * 0x40));
verify(HERE), addr != -1; verify(HERE), addr != umax;
vm::_ref<atomic_t<RsxNotify>>(addr).store( vm::_ref<atomic_t<RsxNotify>>(addr).store(
{ {
@ -1346,7 +1346,7 @@ namespace rsx
u32 dst_offset = method_registers.nv0039_output_offset(); u32 dst_offset = method_registers.nv0039_output_offset();
u32 dst_dma = method_registers.nv0039_output_location(); u32 dst_dma = method_registers.nv0039_output_location();
const bool is_block_transfer = (in_pitch == out_pitch && out_pitch == line_length); const bool is_block_transfer = (in_pitch == out_pitch && out_pitch + 0u == line_length);
const auto read_address = get_address(src_offset, src_dma, HERE); const auto read_address = get_address(src_offset, src_dma, HERE);
const auto write_address = get_address(dst_offset, dst_dma, HERE); const auto write_address = get_address(dst_offset, dst_dma, HERE);
const auto data_length = in_pitch * (line_count - 1) + line_length; const auto data_length = in_pitch * (line_count - 1) + line_length;

View File

@ -985,7 +985,7 @@ void Emulator::Load(const std::string& title_id, bool add_only, bool force_globa
const std::string hdd0_disc = vfs::get("/dev_hdd0/disc/"); const std::string hdd0_disc = vfs::get("/dev_hdd0/disc/");
const std::size_t game_dir_size = 8; // size of PS3_GAME and PS3_GMXX const std::size_t game_dir_size = 8; // size of PS3_GAME and PS3_GMXX
const std::size_t bdvd_pos = m_cat == "DG" && bdvd_dir.empty() && disc.empty() ? elf_dir.rfind("/USRDIR") - game_dir_size : 0; const std::size_t bdvd_pos = m_cat == "DG" && bdvd_dir.empty() && disc.empty() ? elf_dir.rfind("/USRDIR") - game_dir_size : 0;
const bool from_hdd0_game = m_path.find(hdd0_game) != -1; const bool from_hdd0_game = m_path.find(hdd0_game) != umax;
if (bdvd_pos && from_hdd0_game) if (bdvd_pos && from_hdd0_game)
{ {

View File

@ -58,7 +58,7 @@ bool vfs::mount(std::string_view vpath, std::string_view path)
return false; return false;
} }
if (pos == -1) if (pos == umax)
{ {
// Mounting completed // Mounting completed
list.back()->path = path; list.back()->path = path;
@ -146,7 +146,7 @@ std::string vfs::get(std::string_view vpath, std::vector<std::string>* out_dir,
return fs::get_config_dir() + "delete_this_dir.../delete_this..."; return fs::get_config_dir() + "delete_this_dir.../delete_this...";
} }
if (pos == -1) if (pos == umax)
{ {
// Absolute path: finalize // Absolute path: finalize
for (auto it = list.rbegin(), rend = list.rend(); it != rend; it++) for (auto it = list.rbegin(), rend = list.rend(); it != rend; it++)

View File

@ -163,7 +163,7 @@ void ds3_pad_handler::SetPadData(const std::string& padId, u32 largeMotor, u32 s
device->small_motor = smallMotor; device->small_motor = smallMotor;
int index = 0; int index = 0;
for (int i = 0; i < MAX_GAMEPADS; i++) for (uint i = 0; i < MAX_GAMEPADS; i++)
{ {
if (g_cfg_input.player[i]->handler == pad_handler::ds3) if (g_cfg_input.player[i]->handler == pad_handler::ds3)
{ {
@ -222,7 +222,7 @@ std::shared_ptr<ds3_pad_handler::ds3_device> ds3_pad_handler::get_ds3_device(con
return nullptr; return nullptr;
int pad_number = std::stoi(padId.substr(pos + 9)); int pad_number = std::stoi(padId.substr(pos + 9));
if (pad_number > 0 && pad_number <= controllers.size()) if (pad_number > 0 && pad_number + 0u <= controllers.size())
return controllers[static_cast<size_t>(pad_number) - 1]; return controllers[static_cast<size_t>(pad_number) - 1];
return nullptr; return nullptr;

View File

@ -192,7 +192,7 @@ void ds4_pad_handler::SetPadData(const std::string& padId, u32 largeMotor, u32 s
device->smallVibrate = smallMotor; device->smallVibrate = smallMotor;
int index = 0; int index = 0;
for (int i = 0; i < MAX_GAMEPADS; i++) for (uint i = 0; i < MAX_GAMEPADS; i++)
{ {
if (g_cfg_input.player[i]->handler == pad_handler::ds4) if (g_cfg_input.player[i]->handler == pad_handler::ds4)
{ {

View File

@ -738,7 +738,7 @@ void evdev_joystick_handler::get_mapping(const std::shared_ptr<PadDevice>& devic
// Translate any corresponding keycodes to our normal DS3 buttons and triggers // Translate any corresponding keycodes to our normal DS3 buttons and triggers
for (int i = 0; i < static_cast<int>(pad->m_buttons.size()); i++) for (int i = 0; i < static_cast<int>(pad->m_buttons.size()); i++)
{ {
if (pad->m_buttons[i].m_keyCode != button_code) if (pad->m_buttons[i].m_keyCode != button_code + 0u)
continue; continue;
// Be careful to handle mapped axis specially // Be careful to handle mapped axis specially
@ -773,7 +773,7 @@ void evdev_joystick_handler::get_mapping(const std::shared_ptr<PadDevice>& devic
bool pressed_max = false; bool pressed_max = false;
// m_keyCodeMin is the mapped key for left or down // m_keyCodeMin is the mapped key for left or down
if (pad->m_sticks[idx].m_keyCodeMin == button_code) if (pad->m_sticks[idx].m_keyCodeMin == button_code + 0u)
{ {
bool is_direction_min = false; bool is_direction_min = false;
@ -799,7 +799,7 @@ void evdev_joystick_handler::get_mapping(const std::shared_ptr<PadDevice>& devic
} }
// m_keyCodeMax is the mapped key for right or up // m_keyCodeMax is the mapped key for right or up
if (pad->m_sticks[idx].m_keyCodeMax == button_code) if (pad->m_sticks[idx].m_keyCodeMax == button_code + 0u)
{ {
bool is_direction_max = false; bool is_direction_max = false;

View File

@ -633,7 +633,7 @@ bool keyboard_pad_handler::bindPadToDevice(std::shared_ptr<Pad> pad, const std::
void keyboard_pad_handler::ThreadProc() void keyboard_pad_handler::ThreadProc()
{ {
for (int i = 0; i < bindings.size(); i++) for (uint i = 0; i < bindings.size(); i++)
{ {
if (last_connection_status[i] == false) if (last_connection_status[i] == false)
{ {

View File

@ -29,6 +29,7 @@ else()
add_compile_options(-fno-strict-aliasing) add_compile_options(-fno-strict-aliasing)
add_compile_options(-Werror=old-style-cast) add_compile_options(-Werror=old-style-cast)
add_compile_options(-Werror=sign-compare)
#TODO Clean the code so these are removed #TODO Clean the code so these are removed
add_compile_options(-Wno-unused-variable) add_compile_options(-Wno-unused-variable)

View File

@ -272,7 +272,7 @@ void debugger_frame::UpdateUI()
if (!cpu) if (!cpu)
{ {
if (m_last_pc != -1 || m_last_stat) if (m_last_pc != umax || m_last_stat)
{ {
m_last_pc = -1; m_last_pc = -1;
m_last_stat = 0; m_last_stat = 0;
@ -392,7 +392,7 @@ void debugger_frame::OnSelectUnit()
void debugger_frame::DoUpdate() void debugger_frame::DoUpdate()
{ {
// Check if we need to disable a step over bp // Check if we need to disable a step over bp
if (m_last_step_over_breakpoint != -1 && GetPc() == m_last_step_over_breakpoint) if (m_last_step_over_breakpoint != umax && GetPc() == m_last_step_over_breakpoint)
{ {
m_breakpoint_handler->RemoveBreakpoint(m_last_step_over_breakpoint); m_breakpoint_handler->RemoveBreakpoint(m_last_step_over_breakpoint);
m_last_step_over_breakpoint = -1; m_last_step_over_breakpoint = -1;
@ -589,7 +589,7 @@ void debugger_frame::DoStep(bool stepOver)
// Undefine previous step over breakpoint if it hasnt been already // Undefine previous step over breakpoint if it hasnt been already
// This can happen when the user steps over a branch that doesn't return to itself // This can happen when the user steps over a branch that doesn't return to itself
if (m_last_step_over_breakpoint != -1) if (m_last_step_over_breakpoint != umax)
{ {
m_breakpoint_handler->RemoveBreakpoint(next_instruction_pc); m_breakpoint_handler->RemoveBreakpoint(next_instruction_pc);
} }

View File

@ -438,7 +438,7 @@ void log_frame::UpdateUI()
buf.resize(size); buf.resize(size);
buf.resize(m_tty_file.read(&buf.front(), buf.size())); buf.resize(m_tty_file.read(&buf.front(), buf.size()));
if (buf.find_first_of('\0') != -1) if (buf.find_first_of('\0') != umax)
{ {
m_tty_file.seek(s64{0} - buf.size(), fs::seek_mode::seek_cur); m_tty_file.seek(s64{0} - buf.size(), fs::seek_mode::seek_cur);
break; break;

View File

@ -218,7 +218,7 @@ void msg_dialog_frame::ProgressBarReset(u32 index)
m_gauge2->setValue(0); m_gauge2->setValue(0);
} }
if (index == taskbar_index) if (index == taskbar_index + 0u)
{ {
#ifdef _WIN32 #ifdef _WIN32
if (m_tb_progress) if (m_tb_progress)
@ -248,7 +248,7 @@ void msg_dialog_frame::ProgressBarInc(u32 index, u32 delta)
m_gauge2->setValue(std::min(m_gauge2->value() + static_cast<int>(delta), m_gauge2->maximum())); m_gauge2->setValue(std::min(m_gauge2->value() + static_cast<int>(delta), m_gauge2->maximum()));
} }
if (index == taskbar_index || taskbar_index == -1) if (index == taskbar_index + 0u || taskbar_index == -1)
{ {
#ifdef _WIN32 #ifdef _WIN32
if (m_tb_progress) if (m_tb_progress)
@ -281,7 +281,7 @@ void msg_dialog_frame::ProgressBarSetLimit(u32 index, u32 limit)
bool set_taskbar_limit = false; bool set_taskbar_limit = false;
if (index == taskbar_index) if (index == taskbar_index + 0u)
{ {
m_gauge_max = limit; m_gauge_max = limit;
set_taskbar_limit = true; set_taskbar_limit = true;

View File

@ -98,7 +98,7 @@ void register_editor_dialog::updateRegister(const QString& text)
auto& ppu = *static_cast<ppu_thread*>(cpu.get()); auto& ppu = *static_cast<ppu_thread*>(cpu.get());
std::size_t first_brk = reg.find('['); std::size_t first_brk = reg.find('[');
if (first_brk != -1) if (first_brk != umax)
{ {
long reg_index = std::atol(reg.substr(first_brk + 1, reg.length() - first_brk - 2).c_str()); long reg_index = std::atol(reg.substr(first_brk + 1, reg.length() - first_brk - 2).c_str());
if (reg.starts_with("GPR")) str = fmt::format("%016llx", ppu.gpr[reg_index]); if (reg.starts_with("GPR")) str = fmt::format("%016llx", ppu.gpr[reg_index]);
@ -140,7 +140,7 @@ void register_editor_dialog::OnOkay(const std::shared_ptr<cpu_thread>& _cpu)
const auto first_brk = reg.find('['); const auto first_brk = reg.find('[');
try try
{ {
if (first_brk != -1) if (first_brk != umax)
{ {
const long reg_index = std::atol(reg.substr(first_brk + 1, reg.length() - first_brk - 2).c_str()); const long reg_index = std::atol(reg.substr(first_brk + 1, reg.length() - first_brk - 2).c_str());
if (reg.starts_with("GPR") || reg.starts_with("FPR")) if (reg.starts_with("GPR") || reg.starts_with("FPR"))
@ -185,7 +185,7 @@ void register_editor_dialog::OnOkay(const std::shared_ptr<cpu_thread>& _cpu)
const auto first_brk = reg.find('['); const auto first_brk = reg.find('[');
try try
{ {
if (first_brk != -1) if (first_brk != umax)
{ {
const long reg_index = std::atol(reg.substr(first_brk + 1, reg.length() - 2).c_str()); const long reg_index = std::atol(reg.substr(first_brk + 1, reg.length() - 2).c_str());
if (reg.starts_with("GPR")) if (reg.starts_with("GPR"))

View File

@ -596,7 +596,7 @@ void trophy_manager_dialog::ApplyFilter()
return; return;
const int db_pos = m_game_combo->currentData().toInt(); const int db_pos = m_game_combo->currentData().toInt();
if (db_pos >= m_trophies_db.size() || !m_trophies_db[db_pos]) if (db_pos + 0u >= m_trophies_db.size() || !m_trophies_db[db_pos])
return; return;
const auto trop_usr = m_trophies_db[db_pos]->trop_usr.get(); const auto trop_usr = m_trophies_db[db_pos]->trop_usr.get();

View File

@ -274,7 +274,7 @@ bool update_manager::handle_json(const QByteArray& data, bool automatic)
bool update_manager::handle_rpcs3(const QByteArray& rpcs3_data, bool /*automatic*/) bool update_manager::handle_rpcs3(const QByteArray& rpcs3_data, bool /*automatic*/)
{ {
if (m_expected_size != rpcs3_data.size()) if (m_expected_size != rpcs3_data.size() + 0u)
{ {
update_log.error("[Auto-updater] Download size mismatch: %d expected: %d", rpcs3_data.size(), m_expected_size); update_log.error("[Auto-updater] Download size mismatch: %d expected: %d", rpcs3_data.size(), m_expected_size);
return false; return false;
@ -340,7 +340,7 @@ bool update_manager::handle_rpcs3(const QByteArray& rpcs3_data, bool /*automatic
update_log.error("[Auto-updater] Failed to create new AppImage file: %s", replace_path); update_log.error("[Auto-updater] Failed to create new AppImage file: %s", replace_path);
return false; return false;
} }
if (new_appimage.write(rpcs3_data.data(), rpcs3_data.size()) != rpcs3_data.size()) if (new_appimage.write(rpcs3_data.data(), rpcs3_data.size()) != rpcs3_data.size() + 0u)
{ {
update_log.error("[Auto-updater] Failed to write new AppImage file: %s", replace_path); update_log.error("[Auto-updater] Failed to write new AppImage file: %s", replace_path);
return false; return false;

View File

@ -332,7 +332,7 @@ bool stx::multi_cas_record::commit() const noexcept
cmp.m_data[0] = item.m_old; cmp.m_data[0] = item.m_old;
cmp.m_data[1] = id; cmp.m_data[1] = id;
if (item.m_addr->load() == item.m_old && atomic_storage<s64>::load(item.m_addr->m_data[1]) == id) if (item.m_addr->load() == item.m_old && atomic_storage<s64>::load(item.m_addr->m_data[1]) == static_cast<s64>(id))
{ {
if (cmpxchg16(item.m_addr->m_data, cmp.m_data, 0, item.m_new)) if (cmpxchg16(item.m_addr->m_data, cmp.m_data, 0, item.m_new))
{ {
@ -403,7 +403,7 @@ bool stx::multi_cas_record::commit() const noexcept
{ {
return true; return true;
} }
else if (cmp.m_data[0] != m_list[0].m_old) else if (cmp.m_data[0] != static_cast<s64>(m_list[0].m_old))
{ {
return false; return false;
} }
@ -472,7 +472,7 @@ bool stx::multi_cas_record::commit() const noexcept
{ {
break; break;
} }
else if (cmp.m_data[0] != m_list[i].m_old) else if (cmp.m_data[0] != static_cast<s64>(m_list[i].m_old))
{ {
s_records[id].m_state |= s_state_failure; s_records[id].m_state |= s_state_failure;
break; break;
@ -514,7 +514,7 @@ bool stx::multi_cas_record::commit() const noexcept
cmp.m_data[0] = item.m_old; cmp.m_data[0] = item.m_old;
cmp.m_data[1] = id; cmp.m_data[1] = id;
if (item.m_addr->load() == item.m_old && atomic_storage<s64>::load(item.m_addr->m_data[1]) == id) if (item.m_addr->load() == item.m_old && atomic_storage<s64>::load(item.m_addr->m_data[1]) == static_cast<s64>(id))
{ {
// Restore old or set new // Restore old or set new
if (cmpxchg16(item.m_addr->m_data, cmp.m_data, 0, ok ? item.m_new : item.m_old)) if (cmpxchg16(item.m_addr->m_data, cmp.m_data, 0, ok ? item.m_new : item.m_old))