Fix X86 compile warnings

This commit is contained in:
PatrickvL 2017-11-16 11:38:23 +01:00
parent f519674873
commit f2955a5080
1 changed files with 6 additions and 6 deletions

View File

@ -69,7 +69,7 @@ uint32_t EmuX86_IORead32(xbaddr addr)
// But this is enough to keep NXDK from hanging for now. // But this is enough to keep NXDK from hanging for now.
LARGE_INTEGER performanceCount; LARGE_INTEGER performanceCount;
QueryPerformanceCounter(&performanceCount); QueryPerformanceCounter(&performanceCount);
return performanceCount.QuadPart; return static_cast<uint32_t>(performanceCount.QuadPart);
break; break;
} }
@ -766,9 +766,9 @@ bool EmuX86_Opcode_MOVZX(LPEXCEPTION_POINTERS e, _DInst& info)
return true; return true;
} }
inline void EmuX86_SetFlag(LPEXCEPTION_POINTERS e, int flag, int value) inline void EmuX86_SetFlag(LPEXCEPTION_POINTERS e, unsigned flag, bool value)
{ {
e->ContextRecord->EFlags ^= (-value ^ e->ContextRecord->EFlags) & (1 << flag); e->ContextRecord->EFlags ^= (!value ^ e->ContextRecord->EFlags) & (1 << flag);
} }
bool EmuX86_Opcode_AND(LPEXCEPTION_POINTERS e, _DInst& info) bool EmuX86_Opcode_AND(LPEXCEPTION_POINTERS e, _DInst& info)
@ -892,7 +892,7 @@ bool EmuX86_Opcode_DEC(LPEXCEPTION_POINTERS e, _DInst& info)
uint64_t result = dest - 1; uint64_t result = dest - 1;
// Write result back // Write result back
EmuX86_Operand_Write(e, info, 0, result); EmuX86_Operand_Write(e, info, 0, static_cast<uint32_t>(result));
EmuX86_SetFlag(e, EMUX86_EFLAG_OF, (result >> 31) != (dest >> 31)); EmuX86_SetFlag(e, EMUX86_EFLAG_OF, (result >> 31) != (dest >> 31));
// TODO: Figure out how to calculate this EmuX86_SetFlag(e, EMUX86_EFLAG_AF, 0); // TODO: Figure out how to calculate this EmuX86_SetFlag(e, EMUX86_EFLAG_AF, 0);
@ -919,7 +919,7 @@ bool EmuX86_Opcode_INC(LPEXCEPTION_POINTERS e, _DInst& info)
uint64_t result = dest + 1; uint64_t result = dest + 1;
// Write result back // Write result back
EmuX86_Operand_Write(e, info, 0, result); EmuX86_Operand_Write(e, info, 0, static_cast<uint32_t>(result));
EmuX86_SetFlag(e, EMUX86_EFLAG_OF, (result >> 31) != (dest >> 31)); EmuX86_SetFlag(e, EMUX86_EFLAG_OF, (result >> 31) != (dest >> 31));
// TODO: Figure out how to calculate this EmuX86_SetFlag(e, EMUX86_EFLAG_AF, 0); // TODO: Figure out how to calculate this EmuX86_SetFlag(e, EMUX86_EFLAG_AF, 0);
@ -986,7 +986,7 @@ bool EmuX86_Opcode_SUB(LPEXCEPTION_POINTERS e, _DInst& info)
uint64_t result = dest - src; uint64_t result = dest - src;
// Write result back // Write result back
EmuX86_Operand_Write(e, info, 0, result); EmuX86_Operand_Write(e, info, 0, static_cast<uint32_t>(result));
EmuX86_SetFlag(e, EMUX86_EFLAG_CF, (result >> 32) > 0); EmuX86_SetFlag(e, EMUX86_EFLAG_CF, (result >> 32) > 0);
EmuX86_SetFlag(e, EMUX86_EFLAG_OF, (result >> 31) != (dest >> 31)); EmuX86_SetFlag(e, EMUX86_EFLAG_OF, (result >> 31) != (dest >> 31));