1 /* SPDX-License-Identifier: GPL-2.0 */
3 * lzodefs.h -- architecture, OS and compiler specific defines
5 * Copyright (C) 1996-2012 Markus F.X.J. Oberhumer <markus@oberhumer.com>
7 * The full LZO package can be found at:
8 * http://www.oberhumer.com/opensource/lzo/
10 * Changed for Linux kernel use by:
11 * Nitin Gupta <nitingupta910@gmail.com>
12 * Richard Purdie <rpurdie@openedhand.com>
16 #define COPY4(dst, src) \
17 put_unaligned(get_unaligned((const u32 *)(src)), (u32 *)(dst))
18 #if defined(__x86_64__)
19 #define COPY8(dst, src) \
20 put_unaligned(get_unaligned((const u64 *)(src)), (u64 *)(dst))
22 #define COPY8(dst, src) \
23 COPY4(dst, src); COPY4((dst) + 4, (src) + 4)
26 #if defined(__BIG_ENDIAN) && defined(__LITTLE_ENDIAN)
27 #error "conflicting endian definitions"
28 #elif defined(__x86_64__)
29 #define LZO_USE_CTZ64 1
30 #define LZO_USE_CTZ32 1
31 #elif defined(__i386__) || defined(__powerpc__)
32 #define LZO_USE_CTZ32 1
33 #elif defined(__arm__) && (__LINUX_ARM_ARCH__ >= 5)
34 #define LZO_USE_CTZ32 1
37 #define M1_MAX_OFFSET 0x0400
38 #define M2_MAX_OFFSET 0x0800
39 #define M3_MAX_OFFSET 0x4000
40 #define M4_MAX_OFFSET 0xbfff
56 #define lzo_dict_t unsigned short
58 #define D_SIZE (1u << D_BITS)
59 #define D_MASK (D_SIZE - 1)
60 #define D_HIGH ((D_MASK >> 1) + 1)