Merge pull request #7216 from chinhodado/patch-1

Avoid calling GetPointer() multiple times in a row
This commit is contained in:
Henrik Rydgård committed 2014-12-23 09:26:11 +01:00
commit 102aa8e387
1 file changed
+3 -2
+3 -2
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)