0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 #define LZO_VERSION 1
0021
0022 #define COPY4(dst, src) \
0023 put_unaligned(get_unaligned((const u32 *)(src)), (u32 *)(dst))
0024 #if defined(CONFIG_X86_64) || defined(CONFIG_ARM64)
0025 #define COPY8(dst, src) \
0026 put_unaligned(get_unaligned((const u64 *)(src)), (u64 *)(dst))
0027 #else
0028 #define COPY8(dst, src) \
0029 COPY4(dst, src); COPY4((dst) + 4, (src) + 4)
0030 #endif
0031
0032 #if defined(__BIG_ENDIAN) && defined(__LITTLE_ENDIAN)
0033 #error "conflicting endian definitions"
0034 #elif defined(CONFIG_X86_64) || defined(CONFIG_ARM64)
0035 #define LZO_USE_CTZ64 1
0036 #define LZO_USE_CTZ32 1
0037 #define LZO_FAST_64BIT_MEMORY_ACCESS
0038 #elif defined(CONFIG_X86) || defined(CONFIG_PPC)
0039 #define LZO_USE_CTZ32 1
0040 #elif defined(CONFIG_ARM) && (__LINUX_ARM_ARCH__ >= 5)
0041 #define LZO_USE_CTZ32 1
0042 #endif
0043
0044 #define M1_MAX_OFFSET 0x0400
0045 #define M2_MAX_OFFSET 0x0800
0046 #define M3_MAX_OFFSET 0x4000
0047 #define M4_MAX_OFFSET_V0 0xbfff
0048 #define M4_MAX_OFFSET_V1 0xbffe
0049
0050 #define M1_MIN_LEN 2
0051 #define M1_MAX_LEN 2
0052 #define M2_MIN_LEN 3
0053 #define M2_MAX_LEN 8
0054 #define M3_MIN_LEN 3
0055 #define M3_MAX_LEN 33
0056 #define M4_MIN_LEN 3
0057 #define M4_MAX_LEN 9
0058
0059 #define M1_MARKER 0
0060 #define M2_MARKER 64
0061 #define M3_MARKER 32
0062 #define M4_MARKER 16
0063
0064 #define MIN_ZERO_RUN_LENGTH 4
0065 #define MAX_ZERO_RUN_LENGTH (2047 + MIN_ZERO_RUN_LENGTH)
0066
0067 #define lzo_dict_t unsigned short
0068 #define D_BITS 13
0069 #define D_SIZE (1u << D_BITS)
0070 #define D_MASK (D_SIZE - 1)
0071 #define D_HIGH ((D_MASK >> 1) + 1)