From 5faf7513c8d8f457221c14372fe6f55eff1c4eca Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Thu, 28 Feb 2013 14:17:59 -0500 Subject: memcpy_76(): fix behavior on non-ARM architectures The destination is passed as the first argument to memcpy_76() and the source is passed as the second argument. As originally written in commit cb5701e, the first argument was called 'src' (despite being the destination) and the second was called 'dst' (despite being the source). The behavior of the memcpy_76() function was correct despite the backward variable naming. Commit ad673c1 reversed the naming of the two arguments to clarify the semantics of the function but failed to reverse the naming in the ARM assembly code. This broke the function's behavior on ARM devices. Commits a8ce1a0 and f4be52e reversed the argument names again. This fixed ARM support, but broke non-ARM architectures (the arguments to memcpy() in the body of the memcpy_76() function were not also reversed). This change swaps the argument names again and swaps the names in the ARM assembly, restoring correct behavior on non-ARM architectures and aligning the variable names with the function's semantics. Change-Id: Iaeb2b84b6696e3eebf29617dfdc41c55e5226776 --- src/core/SkPaint.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp index d7d6cbd..221be3d 100644 --- a/src/core/SkPaint.cpp +++ b/src/core/SkPaint.cpp @@ -150,7 +150,7 @@ SkPaint::SkPaint() { extern "C" { //Hard coded copy with size of 76 bytes. This will avoid the extra cost //of size checking branching in generic memcpy code - inline void memcpy_76(int* src, const int* dst) { + inline void memcpy_76(int* dst, const int* src) { #if defined(__CPU_ARCH_ARM) __asm__ volatile ("cpy r4, %1 \n" "cpy r5, %0 \n" @@ -166,7 +166,7 @@ extern "C" { "ldm r4, {r0-r2} \n" "stm r12, {r0-r2} \n" : - : "r" (src), "r" (dst) + : "r" (dst), "r" (src) : "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r12"); #else memcpy(dst, src, 76); -- cgit v1.1