mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
More microoptimization
This commit is contained in:
parent
8e2c485373
commit
9109882c04
3 changed files with 25 additions and 18 deletions
|
@ -165,16 +165,6 @@ void Memset(const u32 _Address, const u8 _iValue, const u32 _iLength)
|
|||
}
|
||||
}
|
||||
|
||||
void Memcpy(const u32 to_address, const void *from_data, const u32 len)
|
||||
{
|
||||
memcpy(GetPointer(to_address), from_data, len);
|
||||
}
|
||||
|
||||
void Memcpy(void *to_data, const u32 from_address, const u32 len)
|
||||
{
|
||||
memcpy(to_data,GetPointer(from_address),len);
|
||||
}
|
||||
|
||||
void GetString(std::string& _string, const u32 em_address)
|
||||
{
|
||||
char stringBuffer[2048];
|
||||
|
|
|
@ -117,6 +117,13 @@ u64 Read_U64(const u32 _Address);
|
|||
#define _M_ARM
|
||||
#endif
|
||||
|
||||
inline u8* GetPointerUnchecked(const u32 address) {
|
||||
#if defined(_M_IX86) || defined(_M_ARM32)
|
||||
return (u8 *)(base + (address & MEMVIEW32_MASK));
|
||||
#else
|
||||
return (u8 *)(base + address);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef SAFE_MEMORY
|
||||
u32 ReadUnchecked_U32(const u32 _Address);
|
||||
|
@ -212,8 +219,22 @@ inline const char* GetCharPointer(const u32 address) {
|
|||
}
|
||||
|
||||
void Memset(const u32 _Address, const u8 _Data, const u32 _iLength);
|
||||
void Memcpy(const u32 to_address, const void *from_data, const u32 len);
|
||||
void Memcpy(void *to_data, const u32 from_address, const u32 len);
|
||||
|
||||
inline void Memcpy(const u32 to_address, const void *from_data, const u32 len)
|
||||
{
|
||||
memcpy(GetPointer(to_address), from_data, len);
|
||||
}
|
||||
|
||||
inline void Memcpy(void *to_data, const u32 from_address, const u32 len)
|
||||
{
|
||||
memcpy(to_data, GetPointer(from_address), len);
|
||||
}
|
||||
|
||||
inline void MemcpyUnchecked(void *to_data, const u32 from_address, const u32 len)
|
||||
{
|
||||
memcpy(to_data, GetPointerUnchecked(from_address), len);
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
void ReadStruct(u32 address, T *ptr)
|
||||
|
|
|
@ -253,10 +253,6 @@ void TextureCache::NotifyFramebuffer(u32 address, VirtualFramebuffer *framebuffe
|
|||
}
|
||||
}
|
||||
|
||||
static u32 GetClutAddr() {
|
||||
return ((gstate.clutaddr & 0xFFFFFF) | ((gstate.clutaddrupper << 8) & 0x0F000000));
|
||||
}
|
||||
|
||||
static u32 GetClutIndex(u32 index) {
|
||||
const u32 clutBase = gstate.getClutIndexStartPos();
|
||||
const u32 clutMask = gstate.getClutIndexMask();
|
||||
|
@ -876,10 +872,10 @@ inline bool TextureCache::TexCacheEntry::Matches(u16 dim2, u8 format2, int maxLe
|
|||
}
|
||||
|
||||
void TextureCache::LoadClut() {
|
||||
u32 clutAddr = GetClutAddr();
|
||||
u32 clutAddr = ((gstate.clutaddr & 0xFFFFFF) | ((gstate.clutaddrupper << 8) & 0x0F000000));
|
||||
clutTotalBytes_ = (gstate.loadclut & 0x3f) * 32;
|
||||
if (Memory::IsValidAddress(clutAddr)) {
|
||||
Memory::Memcpy(clutBufRaw_, clutAddr, clutTotalBytes_);
|
||||
Memory::MemcpyUnchecked(clutBufRaw_, clutAddr, clutTotalBytes_);
|
||||
} else {
|
||||
memset(clutBufRaw_, 0xFF, clutTotalBytes_);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue