From 1d8bc13137f03891e67e5c2d1b00f5033cced114 Mon Sep 17 00:00:00 2001 From: ip_gpu Date: Mon, 30 Oct 2017 23:24:37 +0500 Subject: [PATCH] fixed from PVS-Studio: V728 An excessive check can be simplified. The '(A && !B) || (!A && B)' expression is equivalent to the 'bool(A) != bool(B)' expression. disasm_x86.c 2160, 2202, 2297 --- disasm-lib/disasm_x86.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/disasm-lib/disasm_x86.c b/disasm-lib/disasm_x86.c index 26a5d76..1971860 100644 --- a/disasm-lib/disasm_x86.c +++ b/disasm-lib/disasm_x86.c @@ -2157,8 +2157,7 @@ BOOL X86_GetInstruction(INSTRUCTION *Instruction, U8 *Address, U32 Flags) // If there is both a base and index register, the Result will probably be too wrong // to even guess else if (X86Instruction->HasFullDisplacement && - ((X86Instruction->HasBaseRegister && !X86Instruction->HasIndexRegister) || - (!X86Instruction->HasBaseRegister && X86Instruction->HasIndexRegister))) + (X86Instruction->HasBaseRegister != X86Instruction->HasIndexRegister)) { assert(Operand1->Length <= 0xFF); if (!X86Instruction->Scale) @@ -2199,8 +2198,7 @@ BOOL X86_GetInstruction(INSTRUCTION *Instruction, U8 *Address, U32 Flags) // If there is both a base and index register, the Result will probably be too wrong // to even guess else if (X86Instruction->HasFullDisplacement && - ((X86Instruction->HasBaseRegister && !X86Instruction->HasIndexRegister) || - (!X86Instruction->HasBaseRegister && X86Instruction->HasIndexRegister))) + (X86Instruction->HasBaseRegister != X86Instruction->HasIndexRegister)) { //DISASM_OUTPUT(("[0x%08I64X] Scale %d, displacement 0x%08I64x\n", VIRTUAL_ADDRESS, X86Instruction->Scale, X86Instruction->Displacement)); if (!X86Instruction->Scale) @@ -2294,8 +2292,7 @@ BOOL X86_GetInstruction(INSTRUCTION *Instruction, U8 *Address, U32 Flags) // If there is both a base and index register, the Result will probably be too wrong // to even guess else if (Operand->Flags & OP_GLOBAL && - ((X86Instruction->HasBaseRegister && !X86Instruction->HasIndexRegister) || - (!X86Instruction->HasBaseRegister && X86Instruction->HasIndexRegister))) + (X86Instruction->HasBaseRegister != X86Instruction->HasIndexRegister)) { DISASM_OUTPUT(("[0x%08I64X] Data reference (scale %d, size %d, displacement 0x%08I64x)\n", VIRTUAL_ADDRESS, X86Instruction->Scale, Operand->Length, X86Instruction->Displacement)); if (!X86Instruction->Scale)