summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorYann Collet <yann.collet.73@gmail.com>2015-08-16 01:33:57 (GMT)
committerYann Collet <yann.collet.73@gmail.com>2015-08-16 01:33:57 (GMT)
commitd15ac1f1a7dc0a5514849ee1ef04a5ce8d2c3e38 (patch)
tree5d448b5e86c5ec5a7e53be6059c8b736bf8d0712 /lib
parent0f2bf0c54e59d7a926074907556cff883a47f9c5 (diff)
downloadlz4-d15ac1f1a7dc0a5514849ee1ef04a5ce8d2c3e38.zip
lz4-d15ac1f1a7dc0a5514849ee1ef04a5ce8d2c3e38.tar.gz
lz4-d15ac1f1a7dc0a5514849ee1ef04a5ce8d2c3e38.tar.bz2
Slightly improved compression speed on ARMv6
Diffstat (limited to 'lib')
-rw-r--r--lib/lz4.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/lib/lz4.c b/lib/lz4.c
index d808f25..45e15b8 100644
--- a/lib/lz4.c
+++ b/lib/lz4.c
@@ -158,27 +158,28 @@ static U16 LZ4_read16(const void* memPtr) { return *(const U16*) memPtr; }
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 void LZ4_write16(void* memPtr, U16 value) { *(U16*)memPtr = value; }
+
#else
static U16 LZ4_read16(const void* memPtr)
{
- U16 val16;
- memcpy(&val16, memPtr, 2);
- return val16;
+ U16 val; memcpy(&val, memPtr, sizeof(val)); return val;
}
static U32 LZ4_read32(const void* memPtr)
{
- U32 val32;
- memcpy(&val32, memPtr, 4);
- return val32;
+ U32 val; memcpy(&val, memPtr, sizeof(val)); return val;
}
static size_t LZ4_read_ARCH(const void* memPtr)
{
- size_t val;
- memcpy(&val, memPtr, sizeof(val));
- return val;
+ size_t val; memcpy(&val, memPtr, sizeof(val)); return val;
+}
+
+static void LZ4_write16(void* memPtr, U16 value)
+{
+ memcpy(memPtr, &value, sizeof(value));
}
#endif // LZ4_FORCE_DIRECT_MEMORY_ACCESS
@@ -201,7 +202,7 @@ static void LZ4_writeLE16(void* memPtr, U16 value)
{
if (LZ4_isLittleEndian())
{
- memcpy(memPtr, &value, 2);
+ LZ4_write16(memPtr, value);
}
else
{
@@ -218,7 +219,6 @@ static void LZ4_wildCopy(void* dstPtr, const void* srcPtr, void* dstEnd)
const BYTE* s = (const BYTE*)srcPtr;
BYTE* const e = (BYTE*)dstEnd;
do { memcpy(d,s,8); d+=8; s+=8; } while (d<e);
- //do { memcpy(d,s,16); d+=16; s+=16; } while (d<e);
}