Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DSPIntCCUtil: Minor changes #3144

Merged
merged 2 commits into from Oct 6, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
61 changes: 28 additions & 33 deletions Source/Core/Core/DSP/DSPIntCCUtil.cpp
Expand Up @@ -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;

This comment was marked as off-topic.

This comment was marked as off-topic.

}

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
Expand All @@ -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;
}
Expand Down
2 changes: 0 additions & 2 deletions Source/Core/Core/DSP/DSPIntCCUtil.h
Expand Up @@ -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);
Expand Down