2 * lz4defs.h -- architecture specific defines
4 * Copyright (C) 2013, LG Electronics, Kyungsik Lee <kyungsik.lee@lge.com>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
12 * Detects 64 bits mode
14 #if (defined(__x86_64__) || defined(__x86_64) || defined(__amd64__) \
15 || defined(__ppc64__) || defined(__LP64__))
22 * Architecture-specific macros
25 #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) \
26 || defined(CONFIG_ARM) && __LINUX_ARM_ARCH__ >= 6 \
27 && defined(ARM_EFFICIENT_UNALIGNED_ACCESS)
28 typedef struct _U32_S { u32 v; } U32_S;
29 typedef struct _U64_S { u64 v; } U64_S;
31 #define A32(x) (((U32_S *)(x))->v)
32 #define A64(x) (((U64_S *)(x))->v)
34 #define PUT4(s, d) (A32(d) = A32(s))
35 #define PUT8(s, d) (A64(d) = A64(s))
36 #else /* CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS */
39 put_unaligned(get_unaligned((const u32 *) s), (u32 *) d)
41 put_unaligned(get_unaligned((const u64 *) s), (u64 *) d)
46 #define ML_MASK ((1U << ML_BITS) - 1)
47 #define RUN_BITS (8 - ML_BITS)
48 #define RUN_MASK ((1U << RUN_BITS) - 1)
50 #if LZ4_ARCH64/* 64-bit */
53 #define LZ4_COPYSTEP(s, d) \
60 #define LZ4_COPYPACKET(s, d) LZ4_COPYSTEP(s, d)
62 #define LZ4_SECURECOPY(s, d, e) \
65 LZ4_WILDCOPY(s, d, e); \
72 #define LZ4_COPYSTEP(s, d) \
79 #define LZ4_COPYPACKET(s, d) \
85 #define LZ4_SECURECOPY LZ4_WILDCOPY
88 #define LZ4_READ_LITTLEENDIAN_16(d, s, p) \
89 (d = s - get_unaligned_le16(p))
91 #define LZ4_WILDCOPY(s, d, e) \
93 LZ4_COPYPACKET(s, d); \