25 #define LZ4_MAGIC_NUMBER 0x184d2204 27 #define LZ4_MAX_BLOCK_SIZE 0x00100000 29 #define LZ4_FLG_VERSION 0x40 30 #define LZ4_FLG_BLOCK_INDEP 0x20 31 #define LZ4_FLG_BLOCK_CHECKSUM 0x10 32 #define LZ4_FLG_CONTENT_SIZE 0x08 33 #define LZ4_FLG_CONTENT_CHECKSUM 0x04 34 #define LZ4_BD_BYTE 0x70 36 #define LZ4_MIN_MATCH 4 37 #define LZ4_LAST_MATCH_DIST 12 38 #define LZ4_LAST_LITERAL_LENGTH 5 40 #define LZ4_TOKEN_LITERAL_MASK 0xf0 41 #define LZ4_TOKEN_MATCH_MASK 0x0f 43 #define LZ4_HASH_VALUE 0x9E3779B1 45 static inline uint16_t calculateHash(uint32_t input)
50 static inline uint16_t read16(
const uint8_t* ptr)
53 if ((uintptr_t)ptr & 1) {
54 uint16_t value = ptr[0];
55 value += (uint16_t)ptr[1] << 8;
60 return *(uint16_t *)ptr;
64 static inline uint32_t read32(
const uint8_t* ptr)
67 if ((uintptr_t)ptr & 1) {
68 uint32_t value = ptr[0];
69 value += (uint32_t)(*(uint16_t *)(ptr+1)) << 8;
70 value += (uint32_t)(ptr[3]) << 24;
75 return *(uint32_t *)ptr;
79 static inline uint8_t *write16(uint8_t *ptr, uint16_t data)
81 if ((uintptr_t)ptr & 1) {
83 *ptr++ = (data >> 8) & 0xff;
87 *((uint16_t *)ptr) = data;
92 static inline uint8_t *write32(uint8_t *ptr, uint32_t data)
94 if ((uintptr_t)ptr & 1) {
96 *ptr++ = (data >> 8) & 0xff;
97 *ptr++ = (data >> 16) & 0xff;
98 *ptr++ = (data >> 24) & 0xff;
102 *((uint32_t *)ptr) = data;
107 static inline uint16_t checkMatch(
const uint8_t *pos1,
const uint8_t *pos2)
110 while ((*pos1++ == *pos2++) && (length != 0xffff)) {
#define LZ4_HASH_VALUE
Definition: lz4_common.h:43