summaryrefslogtreecommitdiffstats
path: root/lib/lz4.c
diff options
context:
space:
mode:
authorYann Collet <Cyan4973@users.noreply.github.com>2020-11-08 01:18:04 (GMT)
committerGitHub <noreply@github.com>2020-11-08 01:18:04 (GMT)
commit1d02141bf8149c1f0091a4c2548cc4f28092f73a (patch)
tree7f274fb7aa83bc987e0ab18dc5ac98e8167e3210 /lib/lz4.c
parent79a7c940172ae066f9d72462d625fb43e7a0343a (diff)
parentf61eeb7793cd86a1ec80b68b5cd962b108c0489a (diff)
downloadlz4-1d02141bf8149c1f0091a4c2548cc4f28092f73a.zip
lz4-1d02141bf8149c1f0091a4c2548cc4f28092f73a.tar.gz
lz4-1d02141bf8149c1f0091a4c2548cc4f28092f73a.tar.bz2
Merge pull request #941 from lz4/revertinline
Revert "Replace "static" to "LZ4_FORCE_INLINE" for small functions"
Diffstat (limited to 'lib/lz4.c')
-rw-r--r--lib/lz4.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/lib/lz4.c b/lib/lz4.c
index e51fbd7..c41a084 100644
--- a/lib/lz4.c
+++ b/lib/lz4.c
@@ -310,7 +310,7 @@ typedef enum {
#define LZ4_memcpy(dst, src, size) memcpy(dst, src, size)
#endif
-LZ4_FORCE_INLINE unsigned LZ4_isLittleEndian(void)
+static unsigned LZ4_isLittleEndian(void)
{
const union { U32 u; BYTE c[4]; } one = { 1 }; /* don't use static : performance detrimental */
return one.c[0];
@@ -320,12 +320,12 @@ LZ4_FORCE_INLINE unsigned LZ4_isLittleEndian(void)
#if defined(LZ4_FORCE_MEMORY_ACCESS) && (LZ4_FORCE_MEMORY_ACCESS==2)
/* lie to the compiler about data alignment; use with caution */
-LZ4_FORCE_INLINE U16 LZ4_read16(const void* memPtr) { return *(const U16*) memPtr; }
-LZ4_FORCE_INLINE U32 LZ4_read32(const void* memPtr) { return *(const U32*) memPtr; }
-LZ4_FORCE_INLINE reg_t LZ4_read_ARCH(const void* memPtr) { return *(const reg_t*) memPtr; }
+static U16 LZ4_read16(const void* memPtr) { return *(const U16*) memPtr; }
+static U32 LZ4_read32(const void* memPtr) { return *(const U32*) memPtr; }
+static reg_t LZ4_read_ARCH(const void* memPtr) { return *(const reg_t*) memPtr; }
-LZ4_FORCE_INLINE void LZ4_write16(void* memPtr, U16 value) { *(U16*)memPtr = value; }
-LZ4_FORCE_INLINE void LZ4_write32(void* memPtr, U32 value) { *(U32*)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)
@@ -333,36 +333,36 @@ LZ4_FORCE_INLINE void LZ4_write32(void* memPtr, U32 value) { *(U32*)memPtr = val
/* currently only defined for gcc and icc */
typedef union { U16 u16; U32 u32; reg_t uArch; } __attribute__((packed)) unalign;
-LZ4_FORCE_INLINE U16 LZ4_read16(const void* ptr) { return ((const unalign*)ptr)->u16; }
-LZ4_FORCE_INLINE U32 LZ4_read32(const void* ptr) { return ((const unalign*)ptr)->u32; }
-LZ4_FORCE_INLINE reg_t LZ4_read_ARCH(const void* ptr) { return ((const unalign*)ptr)->uArch; }
+static U16 LZ4_read16(const void* ptr) { return ((const unalign*)ptr)->u16; }
+static U32 LZ4_read32(const void* ptr) { return ((const unalign*)ptr)->u32; }
+static reg_t LZ4_read_ARCH(const void* ptr) { return ((const unalign*)ptr)->uArch; }
-LZ4_FORCE_INLINE void LZ4_write16(void* memPtr, U16 value) { ((unalign*)memPtr)->u16 = value; }
-LZ4_FORCE_INLINE void LZ4_write32(void* memPtr, U32 value) { ((unalign*)memPtr)->u32 = 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 /* safe and portable access using memcpy() */
-LZ4_FORCE_INLINE U16 LZ4_read16(const void* memPtr)
+static U16 LZ4_read16(const void* memPtr)
{
U16 val; LZ4_memcpy(&val, memPtr, sizeof(val)); return val;
}
-LZ4_FORCE_INLINE U32 LZ4_read32(const void* memPtr)
+static U32 LZ4_read32(const void* memPtr)
{
U32 val; LZ4_memcpy(&val, memPtr, sizeof(val)); return val;
}
-LZ4_FORCE_INLINE reg_t LZ4_read_ARCH(const void* memPtr)
+static reg_t LZ4_read_ARCH(const void* memPtr)
{
reg_t val; LZ4_memcpy(&val, memPtr, sizeof(val)); return val;
}
-LZ4_FORCE_INLINE void LZ4_write16(void* memPtr, U16 value)
+static void LZ4_write16(void* memPtr, U16 value)
{
LZ4_memcpy(memPtr, &value, sizeof(value));
}
-LZ4_FORCE_INLINE void LZ4_write32(void* memPtr, U32 value)
+static void LZ4_write32(void* memPtr, U32 value)
{
LZ4_memcpy(memPtr, &value, sizeof(value));
}
@@ -370,7 +370,7 @@ LZ4_FORCE_INLINE void LZ4_write32(void* memPtr, U32 value)
#endif /* LZ4_FORCE_MEMORY_ACCESS */
-LZ4_FORCE_INLINE U16 LZ4_readLE16(const void* memPtr)
+static U16 LZ4_readLE16(const void* memPtr)
{
if (LZ4_isLittleEndian()) {
return LZ4_read16(memPtr);
@@ -380,7 +380,7 @@ LZ4_FORCE_INLINE U16 LZ4_readLE16(const void* memPtr)
}
}
-LZ4_FORCE_INLINE void LZ4_writeLE16(void* memPtr, U16 value)
+static void LZ4_writeLE16(void* memPtr, U16 value)
{
if (LZ4_isLittleEndian()) {
LZ4_write16(memPtr, value);