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

Function CopyLine

Source/HLEGraphics/RDPStateManager.cpp:155–203  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

153}
154
155static inline void CopyLine(void * dst, const void * src, u32 bytes)
156{
157#ifdef FAST_TMEM_COPY
158 u32* src32 {(u32*)src};
159 u32* dst32 {(u32*)dst};
160
161 DAEDALUS_ASSERT((bytes&0x3)==0, "CopyLine: Remaning bytes! (%d)",bytes);
162
163 u32 size32 {bytes >> 2};
164 u32 src_alignment {(uintptr_t)src32&0x3};
165
166 if(src_alignment == 0)
167 {
168 while (size32--)
169 {
170 *dst32++ = BSWAP32(src32[0]);
171 src32++;
172 }
173 }
174 else
175 {
176 // Zelda and DK64 have unaligned copies. so let's optimize 'em
177 src32 = (u32*)((uintptr_t)src & ~0x3);
178 u32 src_tmp {*src32++};
179 u32 dst_tmp {};
180
181 // calculate offset 3..1..2
182 u32 offset {4-src_alignment};
183 u32 lshift {src_alignment<<3};
184 u32 rshift {offset<<3};
185
186 while(size32--)
187 {
188 dst_tmp = src_tmp << lshift;
189 src_tmp = *src32++;
190 dst_tmp|= src_tmp >> rshift;
191 *dst32++ = BSWAP32(dst_tmp);
192 }
193 src32 -= offset;
194 }
195#else
196 u8* src8 {(u8*)src};
197 u8* dst8 {(u8*)dst};
198 while(bytes--)
199 {
200 *dst8++ = *(u8*)((uintptr_t)src8++ ^ U8_TWIDDLE);
201 }
202#endif
203}
204
205static inline void CopyLine16(u16 * dst16, const u16 * src16, u32 words)
206{

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected