From 81197f18a0b318bb2d743b44d3a9652e5a0639b5 Mon Sep 17 00:00:00 2001 From: chinhodado Date: Mon, 22 Dec 2014 22:46:37 -0500 Subject: [PATCH] Avoid calling GetPointer() multiple times in a row --- Core/HLE/sceKernelMsgPipe.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Core/HLE/sceKernelMsgPipe.cpp b/Core/HLE/sceKernelMsgPipe.cpp index 7b4e0bf132..b71c53ce4c 100644 --- a/Core/HLE/sceKernelMsgPipe.cpp +++ b/Core/HLE/sceKernelMsgPipe.cpp @@ -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)