From ed87ebc3259abea8f952a7ffd785f670a779bde2 Mon Sep 17 00:00:00 2001 From: Alexandru Gagniuc Date: Wed, 29 Jan 2014 17:02:55 -0600 Subject: 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 Reviewed-on: http://review.coreboot.org/5085 Tested-by: build bot (Jenkins) Reviewed-by: Ronald G. Minnich --- util/cbfstool/lzma/lzma.c | 16 ---------------- 1 file changed, 16 deletions(-) (limited to 'util/cbfstool/lzma') diff --git a/util/cbfstool/lzma/lzma.c b/util/cbfstool/lzma/lzma.c index 5eebc7e60c..7a6081557a 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 */ -- cgit v1.2.3