From be521ff0abf2e3b4849d8e1a88c871d0035a1542 Mon Sep 17 00:00:00 2001 From: JohnHolmesII Date: Fri, 5 Apr 2019 23:15:04 -0700 Subject: [PATCH] Fix warnings related to parentheses --- Utilities/Thread.cpp | 4 ++-- rpcs3/Emu/Cell/Modules/cellGem.cpp | 2 +- rpcs3/Emu/Cell/PPUTranslator.cpp | 2 +- rpcs3/Emu/Cell/SPUInterpreter.cpp | 14 +++++++------- rpcs3/Emu/Cell/SPUThread.cpp | 2 +- rpcs3/Emu/RSX/Common/ProgramStateCache.cpp | 2 +- rpcs3/Emu/RSX/RSXTexture.cpp | 8 ++++---- rpcs3/Emu/RSX/rsx_methods.cpp | 6 +++--- rpcs3/Emu/System.cpp | 2 +- 9 files changed, 21 insertions(+), 21 deletions(-) diff --git a/Utilities/Thread.cpp b/Utilities/Thread.cpp index b07bbe2323..cd8033e87b 100644 --- a/Utilities/Thread.cpp +++ b/Utilities/Thread.cpp @@ -1160,7 +1160,7 @@ bool handle_access_violation(u32 addr, bool is_writing, x64_context* context) } }; - if ((d_size | d_size + addr) >= 0x100000000ull) + if ((d_size | (d_size + addr)) >= 0x100000000ull) { LOG_ERROR(MEMORY, "Invalid d_size (0x%llx)", d_size); report_opcode(); @@ -1170,7 +1170,7 @@ bool handle_access_violation(u32 addr, bool is_writing, x64_context* context) // get length of data being accessed size_t a_size = get_x64_access_size(context, op, reg, d_size, i_size); - if ((a_size | a_size + addr) >= 0x100000000ull) + if ((a_size | (a_size + addr)) >= 0x100000000ull) { LOG_ERROR(MEMORY, "Invalid a_size (0x%llx)", a_size); report_opcode(); diff --git a/rpcs3/Emu/Cell/Modules/cellGem.cpp b/rpcs3/Emu/Cell/Modules/cellGem.cpp index 2186fceee2..3427bfbbc2 100644 --- a/rpcs3/Emu/Cell/Modules/cellGem.cpp +++ b/rpcs3/Emu/Cell/Modules/cellGem.cpp @@ -853,7 +853,7 @@ s32 cellGemPrepareVideoConvert(vm::cptr vc_attribu const auto vc = *vc_attribute; if (!vc_attribute || vc.version == 0 || vc.output_format == 0 || - vc.conversion_flags & CELL_GEM_COMBINE_PREVIOUS_INPUT_FRAME && !vc.buffer_memory) + (vc.conversion_flags & CELL_GEM_COMBINE_PREVIOUS_INPUT_FRAME && !vc.buffer_memory)) { return CELL_GEM_ERROR_INVALID_PARAMETER; } diff --git a/rpcs3/Emu/Cell/PPUTranslator.cpp b/rpcs3/Emu/Cell/PPUTranslator.cpp index 5531bfa835..8d8f1d5ba5 100644 --- a/rpcs3/Emu/Cell/PPUTranslator.cpp +++ b/rpcs3/Emu/Cell/PPUTranslator.cpp @@ -1112,7 +1112,7 @@ void PPUTranslator::VMSUMUHS(ppu_opcode_t op) const auto mh = noncast((a >> 16) * (b >> 16)); const auto s = eval(ml + mh); const auto s2 = eval(s + c); - const auto x = eval(s < ml | s2 < s); + const auto x = eval((s < ml) | (s2 < s)); set_vr(op.vd, select(x, splat(-1), s2)); SetSat(IsNotZero(x.value)); } diff --git a/rpcs3/Emu/Cell/SPUInterpreter.cpp b/rpcs3/Emu/Cell/SPUInterpreter.cpp index c85faafc11..3017f89404 100644 --- a/rpcs3/Emu/Cell/SPUInterpreter.cpp +++ b/rpcs3/Emu/Cell/SPUInterpreter.cpp @@ -333,13 +333,13 @@ bool spu_interpreter::ROTI(spu_thread& spu, spu_opcode_t op) bool spu_interpreter::ROTMI(spu_thread& spu, spu_opcode_t op) { - spu.gpr[op.rt].vi = _mm_srli_epi32(spu.gpr[op.ra].vi, 0-op.i7 & 0x3f); + spu.gpr[op.rt].vi = _mm_srli_epi32(spu.gpr[op.ra].vi, (0-op.i7) & 0x3f); return true; } bool spu_interpreter::ROTMAI(spu_thread& spu, spu_opcode_t op) { - spu.gpr[op.rt].vi = _mm_srai_epi32(spu.gpr[op.ra].vi, 0-op.i7 & 0x3f); + spu.gpr[op.rt].vi = _mm_srai_epi32(spu.gpr[op.ra].vi, (0-op.i7) & 0x3f); return true; } @@ -359,13 +359,13 @@ bool spu_interpreter::ROTHI(spu_thread& spu, spu_opcode_t op) bool spu_interpreter::ROTHMI(spu_thread& spu, spu_opcode_t op) { - spu.gpr[op.rt].vi = _mm_srli_epi16(spu.gpr[op.ra].vi, 0-op.i7 & 0x1f); + spu.gpr[op.rt].vi = _mm_srli_epi16(spu.gpr[op.ra].vi, (0-op.i7) & 0x1f); return true; } bool spu_interpreter::ROTMAHI(spu_thread& spu, spu_opcode_t op) { - spu.gpr[op.rt].vi = _mm_srai_epi16(spu.gpr[op.ra].vi, 0-op.i7 & 0x1f); + spu.gpr[op.rt].vi = _mm_srai_epi16(spu.gpr[op.ra].vi, (0-op.i7) & 0x1f); return true; } @@ -708,7 +708,7 @@ bool spu_interpreter::ROTQMBY(spu_thread& spu, spu_opcode_t op) { const auto a = spu.gpr[op.ra].vi; alignas(64) const __m128i buf[3]{a, _mm_setzero_si128(), _mm_setzero_si128()}; - spu.gpr[op.rt].vi = _mm_loadu_si128((__m128i*)((u8*)buf + (0 - spu.gpr[op.rb]._u32[3] & 0x1f))); + spu.gpr[op.rt].vi = _mm_loadu_si128((__m128i*)((u8*)buf + ((0 - spu.gpr[op.rb]._u32[3]) & 0x1f))); return true; } @@ -789,7 +789,7 @@ bool spu_interpreter::ROTQBII(spu_thread& spu, spu_opcode_t op) bool spu_interpreter::ROTQMBII(spu_thread& spu, spu_opcode_t op) { const auto a = spu.gpr[op.ra].vi; - const s32 n = 0-op.i7 & 0x7; + const s32 n = (0-op.i7) & 0x7; spu.gpr[op.rt].vi = _mm_or_si128(_mm_srli_epi64(a, n), _mm_slli_epi64(_mm_srli_si128(a, 8), 64 - n)); return true; } @@ -814,7 +814,7 @@ bool spu_interpreter::ROTQMBYI(spu_thread& spu, spu_opcode_t op) { const auto a = spu.gpr[op.ra].vi; alignas(64) const __m128i buf[3]{a, _mm_setzero_si128(), _mm_setzero_si128()}; - spu.gpr[op.rt].vi = _mm_loadu_si128((__m128i*)((u8*)buf + (0 - op.i7 & 0x1f))); + spu.gpr[op.rt].vi = _mm_loadu_si128((__m128i*)((u8*)buf + ((0 - op.i7) & 0x1f))); return true; } diff --git a/rpcs3/Emu/Cell/SPUThread.cpp b/rpcs3/Emu/Cell/SPUThread.cpp index d0c2b8ef37..9ec8d3f628 100644 --- a/rpcs3/Emu/Cell/SPUThread.cpp +++ b/rpcs3/Emu/Cell/SPUThread.cpp @@ -2995,7 +2995,7 @@ bool spu_thread::stop_and_signal(u32 code) { if (spuq == v.first) { - if (queue = v.second.lock()) + if ((queue = v.second.lock())) { break; } diff --git a/rpcs3/Emu/RSX/Common/ProgramStateCache.cpp b/rpcs3/Emu/RSX/Common/ProgramStateCache.cpp index 38c6718258..b791333758 100644 --- a/rpcs3/Emu/RSX/Common/ProgramStateCache.cpp +++ b/rpcs3/Emu/RSX/Common/ProgramStateCache.cpp @@ -155,7 +155,7 @@ vertex_program_utils::vertex_program_metadata vertex_program_utils::analyse_vert } } - if (d3.end && (fast_exit || current_instrution >= instruction_range.second) || + if ((d3.end && (fast_exit || current_instrution >= instruction_range.second)) || (current_instrution + 1) == 512) { break; diff --git a/rpcs3/Emu/RSX/RSXTexture.cpp b/rpcs3/Emu/RSX/RSXTexture.cpp index 03b26077e4..9672db5974 100644 --- a/rpcs3/Emu/RSX/RSXTexture.cpp +++ b/rpcs3/Emu/RSX/RSXTexture.cpp @@ -74,7 +74,7 @@ namespace rsx } else max_mipmap_count = floor_log2(static_cast(std::max(width(), height()))) + 1; - + return std::min(verify(HERE, mipmap()), max_mipmap_count); } @@ -167,7 +167,7 @@ namespace rsx if (remap_override) { auto r_component = (remap_ctl >> 2) & 3; - remap_ctl = remap_ctl & ~(3 << 4) | r_component << 4; + remap_ctl = (remap_ctl & ~(3 << 4)) | r_component << 4; } remap_ctl &= 0xFFFF; @@ -181,7 +181,7 @@ namespace rsx if (remap_override) { //Set remap lookup for A component to FORCE_ONE - remap_ctl = remap_ctl & ~(3 << 8) | (1 << 8); + remap_ctl = (remap_ctl & ~(3 << 8)) | (1 << 8); } break; } @@ -190,7 +190,7 @@ namespace rsx } //Remapping tables; format is A-R-G-B - //Remap input table. Contains channel index to read color from + //Remap input table. Contains channel index to read color from const std::array remap_inputs = { static_cast(remap_ctl & 0x3), diff --git a/rpcs3/Emu/RSX/rsx_methods.cpp b/rpcs3/Emu/RSX/rsx_methods.cpp index 3516831351..39f11e92db 100644 --- a/rpcs3/Emu/RSX/rsx_methods.cpp +++ b/rpcs3/Emu/RSX/rsx_methods.cpp @@ -1301,16 +1301,16 @@ namespace rsx void rsx_state::init() { // Special values set at initialization, these are not set by a context reset - registers[NV4097_SET_SHADER_PROGRAM] = (0 << 2) | CELL_GCM_LOCATION_LOCAL + 1; + registers[NV4097_SET_SHADER_PROGRAM] = (0 << 2) | (CELL_GCM_LOCATION_LOCAL + 1); for (u32 i = 0; i < 16; i++) { - registers[NV4097_SET_TEXTURE_FORMAT + (i * 8)] = (1 << 16 /* mipmap */) | ((CELL_GCM_TEXTURE_R5G6B5 | CELL_GCM_TEXTURE_SZ | CELL_GCM_TEXTURE_NR) << 8) | (2 << 4 /* 2D */) | CELL_GCM_LOCATION_LOCAL + 1; + registers[NV4097_SET_TEXTURE_FORMAT + (i * 8)] = (1 << 16 /* mipmap */) | ((CELL_GCM_TEXTURE_R5G6B5 | CELL_GCM_TEXTURE_SZ | CELL_GCM_TEXTURE_NR) << 8) | (2 << 4 /* 2D */) | (CELL_GCM_LOCATION_LOCAL + 1); } for (u32 i = 0; i < 4; i++) { - registers[NV4097_SET_VERTEX_TEXTURE_FORMAT + (i * 8)] = (1 << 16 /* mipmap */) | ((CELL_GCM_TEXTURE_X32_FLOAT | CELL_GCM_TEXTURE_LN | CELL_GCM_TEXTURE_NR) << 8) | (2 << 4 /* 2D */) | CELL_GCM_LOCATION_LOCAL + 1; + registers[NV4097_SET_VERTEX_TEXTURE_FORMAT + (i * 8)] = (1 << 16 /* mipmap */) | ((CELL_GCM_TEXTURE_X32_FLOAT | CELL_GCM_TEXTURE_LN | CELL_GCM_TEXTURE_NR) << 8) | (2 << 4 /* 2D */) | (CELL_GCM_LOCATION_LOCAL + 1); } registers[NV406E_SET_CONTEXT_DMA_SEMAPHORE] = CELL_GCM_CONTEXT_DMA_SEMAPHORE_R; diff --git a/rpcs3/Emu/System.cpp b/rpcs3/Emu/System.cpp index 909120786a..723ca8ea1c 100644 --- a/rpcs3/Emu/System.cpp +++ b/rpcs3/Emu/System.cpp @@ -1347,7 +1347,7 @@ void Emulator::Load(const std::string& title_id, bool add_only, bool force_globa elf_file.open(decrypted_path); } // Decrypt SELF - else if (elf_file = decrypt_self(std::move(elf_file), klic.empty() ? nullptr : klic.data())) + else if ((elf_file = decrypt_self(std::move(elf_file), klic.empty() ? nullptr : klic.data()))) { if (true) {