lzodefs.h 1.5 KB
Newer Older
1
/* SPDX-License-Identifier: GPL-2.0 */
2 3 4
/*
 *  lzodefs.h -- architecture, OS and compiler specific defines
 *
5
 *  Copyright (C) 1996-2012 Markus F.X.J. Oberhumer <markus@oberhumer.com>
6 7 8 9
 *
 *  The full LZO package can be found at:
 *  http://www.oberhumer.com/opensource/lzo/
 *
10
 *  Changed for Linux kernel use by:
11 12 13 14
 *  Nitin Gupta <nitingupta910@gmail.com>
 *  Richard Purdie <rpurdie@openedhand.com>
 */

15 16 17

#define COPY4(dst, src)	\
		put_unaligned(get_unaligned((const u32 *)(src)), (u32 *)(dst))
D
Dave Rodgman 已提交
18
#if defined(CONFIG_X86_64)
19 20 21 22 23 24 25 26 27
#define COPY8(dst, src)	\
		put_unaligned(get_unaligned((const u64 *)(src)), (u64 *)(dst))
#else
#define COPY8(dst, src)	\
		COPY4(dst, src); COPY4((dst) + 4, (src) + 4)
#endif

#if defined(__BIG_ENDIAN) && defined(__LITTLE_ENDIAN)
#error "conflicting endian definitions"
M
Matt Sealey 已提交
28
#elif defined(CONFIG_X86_64) || defined(CONFIG_ARM64)
29 30
#define LZO_USE_CTZ64	1
#define LZO_USE_CTZ32	1
D
Dave Rodgman 已提交
31
#elif defined(CONFIG_X86) || defined(CONFIG_PPC)
32
#define LZO_USE_CTZ32	1
D
Dave Rodgman 已提交
33
#elif defined(CONFIG_ARM) && (__LINUX_ARM_ARCH__ >= 5)
34 35
#define LZO_USE_CTZ32	1
#endif
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55

#define M1_MAX_OFFSET	0x0400
#define M2_MAX_OFFSET	0x0800
#define M3_MAX_OFFSET	0x4000
#define M4_MAX_OFFSET	0xbfff

#define M1_MIN_LEN	2
#define M1_MAX_LEN	2
#define M2_MIN_LEN	3
#define M2_MAX_LEN	8
#define M3_MIN_LEN	3
#define M3_MAX_LEN	33
#define M4_MIN_LEN	3
#define M4_MAX_LEN	9

#define M1_MARKER	0
#define M2_MARKER	64
#define M3_MARKER	32
#define M4_MARKER	16

56 57 58 59
#define lzo_dict_t      unsigned short
#define D_BITS		13
#define D_SIZE		(1u << D_BITS)
#define D_MASK		(D_SIZE - 1)
60
#define D_HIGH		((D_MASK >> 1) + 1)