diff options
Diffstat (limited to 'backends/platform/psp/memory.h')
-rw-r--r-- | backends/platform/psp/memory.h | 48 |
1 files changed, 29 insertions, 19 deletions
diff --git a/backends/platform/psp/memory.h b/backends/platform/psp/memory.h index 6d2d927b1b..3cd441a69f 100644 --- a/backends/platform/psp/memory.h +++ b/backends/platform/psp/memory.h @@ -40,28 +40,13 @@ class PspMemory { private: static void testCopy(const byte *debugDst, const byte *debugSrc, uint32 debugBytes); - static void testSwap(const uint16 *debugDst, const uint16 *debugSrc, uint32 debugBytes, PSPPixelFormat &format); static void copy(byte *dst, const byte *src, uint32 bytes); - static void swap(uint16 *dst16, const uint16 *src16, uint32 bytes, PSPPixelFormat &format); static void copy32Aligned(uint32 *dst32, const uint32 *src32, uint32 bytes); - static void swap32Aligned(uint32 *dst32, const uint32 *src32, uint32 bytes, PSPPixelFormat &format); static void copy32Misaligned(uint32 *dst32, const byte *src, uint32 bytes, uint32 alignSrc); - static void swap32Misaligned(uint32 *dst32, const uint16 *src16, uint32 bytes, PSPPixelFormat &format); - static void copy16(uint16 *dst, const uint16 *src, uint32 bytes); - - // For swapping, we know that we have multiples of 16 bits - static void swap16(uint16 *dst16, const uint16 *src16, uint32 bytes, PSPPixelFormat &format) { - PSP_DEBUG_PRINT("swap16 called with dst16[%p], src16[%p], bytes[%d]\n", dst16, src16, bytes); - uint32 shorts = bytes >> 1; - - while (shorts--) { - *dst16++ = format.swapRedBlue16(*src16++); - } - } - static void copy8(byte *dst, const byte *src, uint32 bytes) { - PSP_DEBUG_PRINT("copy8 called with dst[%p], src[%p], bytes[%d]\n", dst, src, bytes); - while (bytes--) { + static inline void copy8(byte *dst, const byte *src, int32 bytes) { + //PSP_DEBUG_PRINT("copy8 called with dst[%p], src[%p], bytes[%d]\n", dst, src, bytes); + for (;bytes; bytes--) { *dst++ = *src++; } } @@ -75,7 +60,32 @@ public: copy(dst, src, bytes); } } +}; + +#endif /* PSP_MEMORY_H */ + +#if defined(PSP_INCLUDE_SWAP) && !defined(PSP_MEMORY_SWAP_H) +#define PSP_MEMORY_SWAP_H + +//#include "backends/platform/psp/psppixelformat.h" + +class PspMemorySwap { +private: + static void testSwap(const uint16 *debugDst, const uint16 *debugSrc, uint32 debugBytes, PSPPixelFormat &format); + static void swap(uint16 *dst16, const uint16 *src16, uint32 bytes, PSPPixelFormat &format); + static void swap32Aligned(uint32 *dst32, const uint32 *src32, uint32 bytes, PSPPixelFormat &format); + static void swap32Misaligned(uint32 *dst32, const uint16 *src16, uint32 bytes, PSPPixelFormat &format); + // For swapping, we know that we have multiples of 16 bits + static void swap16(uint16 *dst16, const uint16 *src16, uint32 bytes, PSPPixelFormat &format) { + PSP_DEBUG_PRINT("swap16 called with dst16[%p], src16[%p], bytes[%d]\n", dst16, src16, bytes); + uint32 shorts = bytes >> 1; + + while (shorts--) { + *dst16++ = format.swapRedBlue16(*src16++); + } +} +public: static void fastSwap(byte *dst, const byte *src, uint32 bytes, PSPPixelFormat &format) { if (bytes < MIN_AMOUNT_FOR_COMPLEX_COPY * 2) { swap16((uint16 *)dst, (uint16 *)src, bytes, format); @@ -85,6 +95,6 @@ public: } }; -#endif /* PSP_MEMORY_H */ +#endif /* PSP_INCLUDE_SWAP */ |