free(ptr);
}
+
+
void FASTAPASS(3) FCEU_memmove(void *d, void *s, uint32 l)
{
uint32 x;
t|=(int)l;
if(t&3) // Not 4-byte aligned and/or length is not a multiple of 4.
+ {
+ uint8 *tmpd, *tmps;
+
+ tmpd = d;
+ tmps = s;
+
for(x=l;x;x--) // This could be optimized further, though(more tests could be performed).
{
- *(uint8*)d=*(uint8 *)s;
- ((uint8 *)d)++;
- ((uint8 *)s)++;
+ *tmpd=*tmps;
+ tmpd++;
+ tmps++;
+ }
}
else
+ {
+ uint32 *tmpd, *tmps;
+
+ tmpd = d;
+ tmps = s;
+
for(x=l>>2;x;x--)
{
- *(uint32*)d=*(uint32*)s;
- ((uint32 *)d)++;
- ((uint32 *)s)++;
+ *tmpd=*tmps;
+ tmpd++;
+ tmps++;
}
}
+}
+