summaryrefslogtreecommitdiffstats
path: root/tools.c
diff options
context:
space:
mode:
authorMatthias Vogelgesang <matthias.vogelgesang@ipe.fzk.de>2011-03-01 16:14:36 +0100
committerMatthias Vogelgesang <matthias.vogelgesang@ipe.fzk.de>2011-03-01 16:14:36 +0100
commit8a33c993a5771b041b67c365378ac40f76365da7 (patch)
tree77df88aae0638e453397f0809226b7737694817c /tools.c
parentc428e3496a3c5f8046a7f1778b5bdcb551993e7b (diff)
downloadpcitool-8a33c993a5771b041b67c365378ac40f76365da7.tar.gz
pcitool-8a33c993a5771b041b67c365378ac40f76365da7.tar.bz2
pcitool-8a33c993a5771b041b67c365378ac40f76365da7.tar.xz
pcitool-8a33c993a5771b041b67c365378ac40f76365da7.zip
Write LSB first and fix memory allocation bug
Diffstat (limited to 'tools.c')
-rw-r--r--tools.c8
1 files changed, 7 insertions, 1 deletions
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;
}