From 8a33c993a5771b041b67c365378ac40f76365da7 Mon Sep 17 00:00:00 2001 From: Matthias Vogelgesang Date: Tue, 1 Mar 2011 16:14:36 +0100 Subject: Write LSB first and fix memory allocation bug --- tools.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'tools.c') diff --git a/tools.c b/tools.c index 9770b60..4ca3730 100644 --- a/tools.c +++ b/tools.c @@ -15,7 +15,13 @@ void *memcpy32(void * dst, void const * src, size_t len) { uint32_t const * plSrc = (uint32_t const *) src; while (len >= 4) { - *plDst++ = *plSrc++; + uint32_t a = (*plSrc & 0xFF) << 24; + a |= (*plSrc & 0xFF00) << 8; + a |= (*plSrc & 0xFF0000) >> 8; + a |= (*plSrc & 0xFF000000) >> 24; + *plDst = a; + plSrc++; + plDst++; len -= 4; } -- cgit v1.2.3