[coreboot-gerrit] New patch to review for coreboot: 22e87da cbfstool/lzma: Remove LITTLE_ENDIAN_AND_UNALIGNED_ACCESS_OK
Alexandru Gagniuc (mr.nuke.me@gmail.com)
gerrit at coreboot.org
Thu Jan 30 00:08:09 CET 2014
Alexandru Gagniuc (mr.nuke.me at gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/5085
-gerrit
commit 22e87daaf4cbcc76a27838e9a5a24767f6819b27
Author: Alexandru Gagniuc <mr.nuke.me at gmail.com>
Date: Wed Jan 29 17:02:55 2014 -0600
cbfstool/lzma: Remove LITTLE_ENDIAN_AND_UNALIGNED_ACCESS_OK
This was designed as a micro-optimization for x86, but it is only used
once. Let the compiler decide if optimizing this is worth the effort.
Change-Id: I5939efa34f0e9d16643893ca04675247842e7db5
Signed-off-by: Alexandru Gagniuc <mr.nuke.me at gmail.com>
---
util/cbfstool/lzma/lzma.c | 16 ----------------
1 file changed, 16 deletions(-)
diff --git a/util/cbfstool/lzma/lzma.c b/util/cbfstool/lzma/lzma.c
index 5eebc7e..7a60815 100644
--- a/util/cbfstool/lzma/lzma.c
+++ b/util/cbfstool/lzma/lzma.c
@@ -6,33 +6,18 @@
#include "C/LzmaDec.h"
#include "C/LzmaEnc.h"
-/* Endianness / unaligned memory access handling */
-
-#if defined(__x86_64__) || defined(__i386__)
-#define LITTLE_ENDIAN_AND_UNALIGNED_ACCESS_OK
-#else
-#undef LITTLE_ENDIAN_AND_UNALIGNED_ACCESS_OK
-#endif
-
#define L (uint64_t)
static inline uint64_t get_64(const void *p)
{
-#ifdef LITTLE_ENDIAN_AND_UNALIGNED_ACCESS_OK
- return *(const uint64_t *)p;
-#else
const unsigned char *data = (const unsigned char *)p;
return (L data[0]) | (L data[1] << 8) | (L data[2] << 16) |
(L data[3] << 24) | (L data [4] << 32) | (L data[5] << 40) |
(L data[6] << 48) | (L data[7] << 56);
-#endif
}
static void put_64(void *p, uint64_t value)
{
-#ifdef LITTLE_ENDIAN_AND_UNALIGNED_ACCESS_OK
- *(uint64_t *) p = value;
-#else
unsigned char *data = (unsigned char *)p;
data[0] = value & 0xff;
data[1] = (value >> 8) & 0xff;
@@ -42,7 +27,6 @@ static void put_64(void *p, uint64_t value)
data[5] = (value >> 40) & 0xff;
data[6] = (value >> 48) & 0xff;
data[7] = (value >> 56) & 0xff;
-#endif
}
/* Memory Allocation API */
More information about the coreboot-gerrit
mailing list