Avoid calling GetPointer() multiple times in a row

This commit is contained in:
chinhodado 2014-12-22 22:46:37 -05:00
parent 2e675c7b0b
commit 81197f18a0

View file

@ -215,10 +215,11 @@ struct MsgPipe : public KernelObject
// Receive as much as possible, even if it's not enough to wake up.
u32 bytesToSend = std::min(thread->freeSize, GetUsedSize());
thread->WriteBuffer(Memory::GetPointer(buffer), bytesToSend);
u8* ptr = Memory::GetPointer(buffer);
thread->WriteBuffer(ptr, bytesToSend);
// Put the unused data at the start of the buffer.
nmp.freeSize += bytesToSend;
memmove(Memory::GetPointer(buffer), Memory::GetPointer(buffer) + bytesToSend, GetUsedSize());
memmove(ptr, ptr + bytesToSend, GetUsedSize());
freedSpace = true;
if (thread->waitMode == SCE_KERNEL_MPW_ASAP || thread->freeSize == 0)