MCPcopy Create free account
hub / github.com/DaedalusX64/daedalus / CopyLineSwap

Function CopyLineSwap

Source/HLEGraphics/RDPStateManager.cpp:229–263  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

227}
228
229static inline void CopyLineSwap(void * dst, const void * src, u32 bytes)
230{
231 u32* src32 {(u32*)src};
232 u32* dst32 {(u32*)dst};
233
234#ifdef FAST_TMEM_COPY
235 DAEDALUS_ASSERT((bytes&0x7)==0, "CopyLineSwap: Remaning bytes! (%d)",bytes);
236
237 if( ((uintptr_t)src32&0x3 )==0)
238 {
239 u32 size64 {bytes >> 3};
240
241 while (size64--)
242 {
243 dst32[0] = BSWAP32(src32[1]);
244 dst32[1] = BSWAP32(src32[0]);
245 dst32 += 2;
246 src32 += 2;
247 }
248 }
249 else
250#endif
251 {
252 // Optimize me: Bomberman, Zelda, and Quest 64 have unaligned copies here
253 //DBGConsole_Msg(0, "[WWarning CopyLineSwap: Performing slow copy]" );
254
255 u8* src8 {(u8*)src32};
256 u8* dst8 {(u8*)dst32};
257 while(bytes--)
258 {
259 // Alternate 32 bit words are swapped
260 *(u8*)((uintptr_t)dst8++ ^ 0x4) = *(u8*)((uintptr_t)src8++ ^ U8_TWIDDLE);
261 }
262 }
263}
264
265static inline void CopyLineSwap32(void * dst, const void * src, u32 bytes)
266{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected