Cache: Make CacheTag/CacheData POD

This commit is contained in:
Stenzek 2024-01-08 22:31:11 +10:00 committed by Connor McLaughlin
parent 4800c32db4
commit bfe1746ddb
1 changed files with 4 additions and 9 deletions

View File

@ -14,15 +14,11 @@ namespace
union alignas(64) CacheData
{
u8 bytes[64];
constexpr CacheData(): bytes{0} {}
};
struct CacheTag
{
uptr rawValue = 0;
CacheTag() = default;
uptr rawValue;
// The lower parts of a cache tags structure is as follows:
// 31 - 12: The physical address cache tag.
@ -112,7 +108,7 @@ namespace
pxAssertMsg(!tag.isDirtyAndValid(), "Loaded a value into cache without writing back the old one!");
tag.setAddr(ppf);
data = *reinterpret_cast<CacheData*>(ppf & ~0x3FULL);
std::memcpy(&data, reinterpret_cast<void*>(ppf & ~0x3FULL), sizeof(data));
tag.setValid();
tag.clearDirty();
}
@ -120,7 +116,7 @@ namespace
void clear()
{
tag.clear();
data = CacheData();
std::memset(&data, 0, sizeof(data));
}
};
@ -145,8 +141,7 @@ namespace
}
};
static Cache cache;
static Cache cache = {};
}
void resetCache()