Merge pull request #12394 from lioncash/compare

General: Resolve -Wsign-compare warnings
This commit is contained in:
Admiral H. Curtiss 2023-12-12 03:43:12 +01:00 committed by GitHub
commit 2c6bf2d224
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 9 additions and 8 deletions

View File

@ -19,8 +19,9 @@ jobjectArray VectorToJStringArray(JNIEnv* env, const std::vector<std::string>& v
template <typename T, typename F> template <typename T, typename F>
jobjectArray VectorToJObjectArray(JNIEnv* env, const std::vector<T>& vector, jclass clazz, F f) jobjectArray VectorToJObjectArray(JNIEnv* env, const std::vector<T>& vector, jclass clazz, F f)
{ {
jobjectArray result = env->NewObjectArray(vector.size(), clazz, nullptr); const auto vector_size = static_cast<jsize>(vector.size());
for (jsize i = 0; i < vector.size(); ++i) jobjectArray result = env->NewObjectArray(vector_size, clazz, nullptr);
for (jsize i = 0; i < vector_size; ++i)
{ {
jobject obj = f(env, vector[i]); jobject obj = f(env, vector[i]);
env->SetObjectArrayElement(result, i, obj); env->SetObjectArrayElement(result, i, obj);

View File

@ -373,7 +373,7 @@ void TraversalClient::HandleTraversalTest()
waitCondition = 0; waitCondition = 0;
break; break;
} }
else if (rv < sizeof(packet) || raddr.host != m_ServerAddress.host || else if (rv < int(sizeof(packet)) || raddr.host != m_ServerAddress.host ||
raddr.host != m_portAlt || packet.requestId != m_TestRequestId) raddr.host != m_portAlt || packet.requestId != m_TestRequestId)
{ {
// irrelevant packet, ignore // irrelevant packet, ignore

View File

@ -248,7 +248,7 @@ void Arm64GPRCache::FlushRegisters(BitSet32 regs, bool maintain_state, ARM64Reg
ASSERT_MSG(DYNA_REC, m_guest_registers[GUEST_GPR_OFFSET + i].GetType() != RegType::Discarded, ASSERT_MSG(DYNA_REC, m_guest_registers[GUEST_GPR_OFFSET + i].GetType() != RegType::Discarded,
"Attempted to flush discarded register"); "Attempted to flush discarded register");
if (i + 1 < GUEST_GPR_COUNT && regs[i + 1]) if (i + 1 < int(GUEST_GPR_COUNT) && regs[i + 1])
{ {
// We've got two guest registers in a row to store // We've got two guest registers in a row to store
OpArg& reg1 = m_guest_registers[GUEST_GPR_OFFSET + i]; OpArg& reg1 = m_guest_registers[GUEST_GPR_OFFSET + i];

View File

@ -236,9 +236,9 @@ void JitArm64::twx(UGeckoInstruction inst)
constexpr std::array<CCFlags, 5> conditions{{CC_LT, CC_GT, CC_EQ, CC_VC, CC_VS}}; constexpr std::array<CCFlags, 5> conditions{{CC_LT, CC_GT, CC_EQ, CC_VC, CC_VS}};
Common::SmallVector<FixupBranch, conditions.size()> fixups; Common::SmallVector<FixupBranch, conditions.size()> fixups;
for (int i = 0; i < conditions.size(); i++) for (size_t i = 0; i < conditions.size(); i++)
{ {
if (inst.TO & (1 << i)) if (inst.TO & (1U << i))
{ {
FixupBranch f = B(conditions[i]); FixupBranch f = B(conditions[i]);
fixups.push_back(f); fixups.push_back(f);

View File

@ -598,7 +598,7 @@ void VertexManagerBase::Flush()
std::optional<CustomPixelShader> custom_pixel_shader; std::optional<CustomPixelShader> custom_pixel_shader;
std::vector<std::string> custom_pixel_texture_names; std::vector<std::string> custom_pixel_texture_names;
std::span<u8> custom_pixel_shader_uniforms; std::span<u8> custom_pixel_shader_uniforms;
for (int i = 0; i < texture_names.size(); i++) for (size_t i = 0; i < texture_names.size(); i++)
{ {
const std::string& texture_name = texture_names[i]; const std::string& texture_name = texture_names[i];
const u32 texture_unit = texture_units[i]; const u32 texture_unit = texture_units[i];

View File

@ -85,7 +85,7 @@ TEST(FloatUtils, ApproximateReciprocalSquareRoot)
0x7FF8'0000'0000'0000, 0x7FF8'0000'0000'0000, 0x3FEA'2040'0000'0000, 0x3FA0'3108'0000'0000, 0x7FF8'0000'0000'0000, 0x7FF8'0000'0000'0000, 0x3FEA'2040'0000'0000, 0x3FA0'3108'0000'0000,
0x7FF8'0000'0000'0000}; 0x7FF8'0000'0000'0000};
for (int i = 0; i < double_test_values.size(); ++i) for (size_t i = 0; i < double_test_values.size(); ++i)
{ {
u64 ivalue = double_test_values[i]; u64 ivalue = double_test_values[i];
double dvalue = Common::BitCast<double>(ivalue); double dvalue = Common::BitCast<double>(ivalue);