Fixed : alignment warning
This commit is contained in:
parent
bc342ab94c
commit
410ec81543
13
lib/lz4.c
13
lib/lz4.c
@ -171,6 +171,7 @@ static U32 LZ4_read32(const void* memPtr) { return *(const U32*) memPtr; }
|
|||||||
static size_t LZ4_read_ARCH(const void* memPtr) { return *(const size_t*) memPtr; }
|
static size_t LZ4_read_ARCH(const void* memPtr) { return *(const size_t*) memPtr; }
|
||||||
|
|
||||||
static void LZ4_write16(void* memPtr, U16 value) { *(U16*)memPtr = value; }
|
static void LZ4_write16(void* memPtr, U16 value) { *(U16*)memPtr = value; }
|
||||||
|
static void LZ4_write32(void* memPtr, U32 value) { *(U32*)memPtr = value; }
|
||||||
|
|
||||||
#elif defined(LZ4_FORCE_MEMORY_ACCESS) && (LZ4_FORCE_MEMORY_ACCESS==1)
|
#elif defined(LZ4_FORCE_MEMORY_ACCESS) && (LZ4_FORCE_MEMORY_ACCESS==1)
|
||||||
|
|
||||||
@ -183,6 +184,7 @@ static U32 LZ4_read32(const void* ptr) { return ((const unalign*)ptr)->u32; }
|
|||||||
static size_t LZ4_read_ARCH(const void* ptr) { return ((const unalign*)ptr)->uArch; }
|
static size_t LZ4_read_ARCH(const void* ptr) { return ((const unalign*)ptr)->uArch; }
|
||||||
|
|
||||||
static void LZ4_write16(void* memPtr, U16 value) { ((unalign*)memPtr)->u16 = value; }
|
static void LZ4_write16(void* memPtr, U16 value) { ((unalign*)memPtr)->u16 = value; }
|
||||||
|
static void LZ4_write32(void* memPtr, U32 value) { ((unalign*)memPtr)->u32 = value; }
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
@ -206,6 +208,11 @@ static void LZ4_write16(void* memPtr, U16 value)
|
|||||||
memcpy(memPtr, &value, sizeof(value));
|
memcpy(memPtr, &value, sizeof(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void LZ4_write32(void* memPtr, U32 value)
|
||||||
|
{
|
||||||
|
memcpy(memPtr, &value, sizeof(value));
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* LZ4_FORCE_MEMORY_ACCESS */
|
#endif /* LZ4_FORCE_MEMORY_ACCESS */
|
||||||
|
|
||||||
|
|
||||||
@ -605,8 +612,8 @@ _next_match:
|
|||||||
if (matchCode >= ML_MASK) {
|
if (matchCode >= ML_MASK) {
|
||||||
*token += ML_MASK;
|
*token += ML_MASK;
|
||||||
matchCode -= ML_MASK;
|
matchCode -= ML_MASK;
|
||||||
*(U32*)op = 0xFFFFFFFF;
|
LZ4_write32(op, 0xFFFFFFFF);
|
||||||
while (matchCode >= 4*255) op+=4, *(U32*)op=0xFFFFFFFF, matchCode -= 4*255;
|
while (matchCode >= 4*255) op+=4, LZ4_write32(op, 0xFFFFFFFF), matchCode -= 4*255;
|
||||||
op += matchCode / 255;
|
op += matchCode / 255;
|
||||||
*op++ = (BYTE)(matchCode % 255);
|
*op++ = (BYTE)(matchCode % 255);
|
||||||
} else
|
} else
|
||||||
@ -1199,8 +1206,8 @@ FORCE_INLINE int LZ4_decompress_generic(
|
|||||||
if (length == ML_MASK) {
|
if (length == ML_MASK) {
|
||||||
unsigned s;
|
unsigned s;
|
||||||
do {
|
do {
|
||||||
if ((endOnInput) && (ip > iend-LASTLITERALS)) goto _output_error;
|
|
||||||
s = *ip++;
|
s = *ip++;
|
||||||
|
if ((endOnInput) && (ip > iend-LASTLITERALS)) goto _output_error;
|
||||||
length += s;
|
length += s;
|
||||||
} while (s==255);
|
} while (s==255);
|
||||||
if ((safeDecode) && unlikely((size_t)(op+length)<(size_t)op)) goto _output_error; /* overflow detection */
|
if ((safeDecode) && unlikely((size_t)(op+length)<(size_t)op)) goto _output_error; /* overflow detection */
|
||||||
|
3
programs/.gitignore
vendored
3
programs/.gitignore
vendored
@ -1,7 +1,10 @@
|
|||||||
# local binary (Makefile)
|
# local binary (Makefile)
|
||||||
lz4
|
lz4
|
||||||
|
lz4c
|
||||||
lz4c32
|
lz4c32
|
||||||
datagen
|
datagen
|
||||||
|
frametest
|
||||||
|
fullbench
|
||||||
fuzzer
|
fuzzer
|
||||||
*.exe
|
*.exe
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user