Merge pull request #3144 from lioncash/dsp

DSPIntCCUtil: Minor changes
This commit is contained in:
shuffle2 2015-10-06 13:03:11 -07:00
commit ec28d7df92
2 changed files with 28 additions and 35 deletions

View File

@ -106,44 +106,39 @@ void Update_SR_LZ(bool value)
g_dsp.r.sr &= ~SR_LOGIC_ZERO;
}
inline int GetMultiplyModifier()
static bool IsCarry()
{
return (g_dsp.r.sr & SR_MUL_MODIFY)?1:2;
return (g_dsp.r.sr & SR_CARRY) != 0;
}
inline bool isCarry()
static bool IsOverflow()
{
return (g_dsp.r.sr & SR_CARRY) ? true : false;
return (g_dsp.r.sr & SR_OVERFLOW) != 0;
}
inline bool isOverflow()
static bool IsOverS32()
{
return (g_dsp.r.sr & SR_OVERFLOW) ? true : false;
return (g_dsp.r.sr & SR_OVER_S32) != 0;
}
inline bool isOverS32()
{
return (g_dsp.r.sr & SR_OVER_S32) ? true : false;
}
inline bool isLess()
static bool IsLess()
{
return (!(g_dsp.r.sr & SR_OVERFLOW) != !(g_dsp.r.sr & SR_SIGN));
}
inline bool isZero()
static bool IsZero()
{
return (g_dsp.r.sr & SR_ARITH_ZERO) ? true : false;
return (g_dsp.r.sr & SR_ARITH_ZERO) != 0;
}
inline bool isLogicZero()
static bool IsLogicZero()
{
return (g_dsp.r.sr & SR_LOGIC_ZERO) ? true : false;
return (g_dsp.r.sr & SR_LOGIC_ZERO) != 0;
}
inline bool isConditionA()
static bool IsConditionA()
{
return (((g_dsp.r.sr & SR_OVER_S32) || (g_dsp.r.sr & SR_TOP2BITS)) && !(g_dsp.r.sr & SR_ARITH_ZERO)) ? true : false;
return (((g_dsp.r.sr & SR_OVER_S32) || (g_dsp.r.sr & SR_TOP2BITS)) && !(g_dsp.r.sr & SR_ARITH_ZERO)) != 0;
}
//see DSPCore.h for flags
@ -154,35 +149,35 @@ bool CheckCondition(u8 _Condition)
case 0xf: // Always true.
return true;
case 0x0: // GE - Greater Equal
return !isLess();
return !IsLess();
case 0x1: // L - Less
return isLess();
return IsLess();
case 0x2: // G - Greater
return !isLess() && !isZero();
return !IsLess() && !IsZero();
case 0x3: // LE - Less Equal
return isLess() || isZero();
return IsLess() || IsZero();
case 0x4: // NZ - Not Zero
return !isZero();
return !IsZero();
case 0x5: // Z - Zero
return isZero();
return IsZero();
case 0x6: // NC - Not carry
return !isCarry();
return !IsCarry();
case 0x7: // C - Carry
return isCarry();
return IsCarry();
case 0x8: // ? - Not over s32
return !isOverS32();
return !IsOverS32();
case 0x9: // ? - Over s32
return isOverS32();
return IsOverS32();
case 0xa: // ?
return isConditionA();
return IsConditionA();
case 0xb: // ?
return !isConditionA();
return !IsConditionA();
case 0xc: // LNZ - Logic Not Zero
return !isLogicZero();
return !IsLogicZero();
case 0xd: // LZ - Logic Zero
return isLogicZero();
return IsLogicZero();
case 0xe: // 0 - Overflow
return isOverflow();
return IsOverflow();
default:
return true;
}

View File

@ -15,8 +15,6 @@ namespace DSPInterpreter
bool CheckCondition(u8 _Condition);
int GetMultiplyModifier();
void Update_SR_Register16(s16 _Value, bool carry = false, bool overflow = false, bool overS32 = false);
void Update_SR_Register64(s64 _Value, bool carry = false, bool overflow = false);
void Update_SR_LZ(bool value);