From 77417fc4c2d955bdf7ffd2b8d5a5f37157def5d5 Mon Sep 17 00:00:00 2001 From: "yann.collet.73@gmail.com" Date: Sat, 22 Dec 2012 17:56:05 +0000 Subject: LZ4_HC is now compatible with CPU requiring aligned memory accesses git-svn-id: https://lz4.googlecode.com/svn/trunk@87 650e7d94-2a16-8b24-b05c-7c0b3f6821cd --- lz4hc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lz4hc.c b/lz4hc.c index 200efda..d563fde 100644 --- a/lz4hc.c +++ b/lz4hc.c @@ -224,7 +224,7 @@ typedef struct #define LZ4_WILDCOPY(s,d,e) do { LZ4_COPYPACKET(s,d) } while (d> ((MINMATCH*8)-HASH_LOG)) -#define HASH_VALUE(p) HASH_FUNCTION(*(U32*)(p)) +#define HASH_VALUE(p) HASH_FUNCTION(A32(p)) #define HASH_POINTER(p) (HashTable[HASH_VALUE(p)] + base) #define DELTANEXT(p) chainTable[(size_t)(p) & MAXD_MASK] #define GETNEXT(p) ((p) - (size_t)DELTANEXT(p)) @@ -357,7 +357,7 @@ inline static int LZ4HC_InsertAndFindBestMatch (LZ4HC_Data_Structure* hc4, const { nbAttempts--; if (*(ref+ml) == *(ip+ml)) - if (*(U32*)ref == *(U32*)ip) + if (A32(ref) == A32(ip)) { const BYTE* reft = ref+MINMATCH; const BYTE* ipt = ip+MINMATCH; @@ -400,7 +400,7 @@ inline static int LZ4HC_InsertAndGetWiderMatch (LZ4HC_Data_Structure* hc4, const { nbAttempts--; if (*(startLimit + longest) == *(ref - delta + longest)) - if (*(U32*)ref == *(U32*)ip) + if (A32(ref) == A32(ip)) { const BYTE* reft = ref+MINMATCH; const BYTE* ipt = ip+MINMATCH; -- cgit v0.12