| .. | .. |
|---|
| 75 | 75 | #define WILDCOPYLENGTH 8 |
|---|
| 76 | 76 | #define LASTLITERALS 5 |
|---|
| 77 | 77 | #define MFLIMIT (WILDCOPYLENGTH + MINMATCH) |
|---|
| 78 | +/* |
|---|
| 79 | + * ensure it's possible to write 2 x wildcopyLength |
|---|
| 80 | + * without overflowing output buffer |
|---|
| 81 | + */ |
|---|
| 82 | +#define MATCH_SAFEGUARD_DISTANCE ((2 * WILDCOPYLENGTH) - MINMATCH) |
|---|
| 78 | 83 | |
|---|
| 79 | 84 | /* Increase this value ==> compression run slower on incompressible data */ |
|---|
| 80 | 85 | #define LZ4_SKIPTRIGGER 6 |
|---|
| .. | .. |
|---|
| 131 | 136 | { |
|---|
| 132 | 137 | return put_unaligned_le16(value, memPtr); |
|---|
| 133 | 138 | } |
|---|
| 139 | + |
|---|
| 140 | +/* |
|---|
| 141 | + * LZ4 relies on memcpy with a constant size being inlined. In freestanding |
|---|
| 142 | + * environments, the compiler can't assume the implementation of memcpy() is |
|---|
| 143 | + * standard compliant, so apply its specialized memcpy() inlining logic. When |
|---|
| 144 | + * possible, use __builtin_memcpy() to tell the compiler to analyze memcpy() |
|---|
| 145 | + * as-if it were standard compliant, so it can inline it in freestanding |
|---|
| 146 | + * environments. This is needed when decompressing the Linux Kernel, for example. |
|---|
| 147 | + */ |
|---|
| 148 | +#define LZ4_memcpy(dst, src, size) __builtin_memcpy(dst, src, size) |
|---|
| 149 | +#define LZ4_memmove(dst, src, size) __builtin_memmove(dst, src, size) |
|---|
| 134 | 150 | |
|---|
| 135 | 151 | static FORCE_INLINE void LZ4_copy8(void *dst, const void *src) |
|---|
| 136 | 152 | { |
|---|
| .. | .. |
|---|
| 222 | 238 | typedef enum { noDictIssue = 0, dictSmall } dictIssue_directive; |
|---|
| 223 | 239 | |
|---|
| 224 | 240 | typedef enum { endOnOutputSize = 0, endOnInputSize = 1 } endCondition_directive; |
|---|
| 225 | | -typedef enum { full = 0, partial = 1 } earlyEnd_directive; |
|---|
| 241 | +typedef enum { decode_full_block = 0, partial_decode = 1 } earlyEnd_directive; |
|---|
| 242 | + |
|---|
| 243 | +#define LZ4_STATIC_ASSERT(c) BUILD_BUG_ON(!(c)) |
|---|
| 226 | 244 | |
|---|
| 227 | 245 | #endif |
|---|