2016-07-06 20:14:12 +00:00
|
|
|
#include "stdafx.h"
|
2022-10-10 00:22:17 +00:00
|
|
|
|
2016-07-06 20:14:12 +00:00
|
|
|
#include <Project64-core/N64System/Recompiler/RegBase.h>
|
|
|
|
|
|
|
|
CRegBase::CRegBase() :
|
2022-10-10 00:22:17 +00:00
|
|
|
m_CycleCount(0),
|
|
|
|
m_Fpu_Used(false),
|
|
|
|
m_RoundingModel(RoundUnknown)
|
2016-07-06 20:14:12 +00:00
|
|
|
{
|
2016-07-20 12:22:56 +00:00
|
|
|
for (int32_t i = 0; i < 32; i++)
|
2016-07-06 20:14:12 +00:00
|
|
|
{
|
|
|
|
m_MIPS_RegState[i] = STATE_UNKNOWN;
|
|
|
|
m_MIPS_RegVal[i].DW = 0;
|
|
|
|
}
|
2016-07-20 12:22:56 +00:00
|
|
|
m_MIPS_RegState[0] = STATE_CONST_32_SIGN;
|
|
|
|
}
|
|
|
|
|
2022-10-10 00:22:17 +00:00
|
|
|
bool CRegBase::operator==(const CRegBase & right) const
|
2016-07-20 12:22:56 +00:00
|
|
|
{
|
|
|
|
for (uint32_t count = 0; count < 32; count++)
|
|
|
|
{
|
|
|
|
if (m_MIPS_RegState[count] != right.m_MIPS_RegState[count])
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (m_MIPS_RegState[count] == STATE_UNKNOWN)
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (m_MIPS_RegVal[count].DW != right.m_MIPS_RegVal[count].DW)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
2022-10-10 00:22:17 +00:00
|
|
|
if (m_CycleCount != right.m_CycleCount)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (m_Fpu_Used != right.m_Fpu_Used)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (GetRoundingModel() != right.GetRoundingModel())
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2016-07-20 12:22:56 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2022-10-10 00:22:17 +00:00
|
|
|
bool CRegBase::operator!=(const CRegBase & right) const
|
2016-07-20 12:22:56 +00:00
|
|
|
{
|
|
|
|
return !(right == *this);
|
|
|
|
}
|
|
|
|
|
2022-10-10 00:22:17 +00:00
|
|
|
CRegBase & CRegBase::operator=(const CRegBase & right)
|
2016-07-20 12:22:56 +00:00
|
|
|
{
|
|
|
|
memcpy(&m_MIPS_RegState, &right.m_MIPS_RegState, sizeof(m_MIPS_RegState));
|
|
|
|
memcpy(&m_MIPS_RegVal, &right.m_MIPS_RegVal, sizeof(m_MIPS_RegVal));
|
|
|
|
m_CycleCount = right.m_CycleCount;
|
|
|
|
m_Fpu_Used = right.m_Fpu_Used;
|
2016-09-24 22:29:45 +00:00
|
|
|
m_RoundingModel = right.m_RoundingModel;
|
2016-07-20 12:22:56 +00:00
|
|
|
#ifdef _DEBUG
|
|
|
|
if (*this != right)
|
|
|
|
{
|
|
|
|
g_Notify->BreakPoint(__FILE__, __LINE__);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
return *this;
|
2016-09-24 22:29:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const char * CRegBase::RoundingModelName(FPU_ROUND RoundType)
|
|
|
|
{
|
|
|
|
switch (RoundType)
|
|
|
|
{
|
2022-10-10 00:22:17 +00:00
|
|
|
case RoundUnknown: return "RoundUnknown";
|
|
|
|
case RoundDefault: return "RoundDefault";
|
2016-09-24 22:29:45 +00:00
|
|
|
case RoundTruncate: return "RoundTruncate";
|
2022-10-10 00:22:17 +00:00
|
|
|
case RoundNearest: return "RoundNearest";
|
|
|
|
case RoundDown: return "RoundDown";
|
|
|
|
case RoundUp: return "RoundUp";
|
2016-09-24 22:29:45 +00:00
|
|
|
}
|
|
|
|
return "** Invalid **";
|
|
|
|
}
|