lzodefs.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * lzodefs.h -- architecture, OS and compiler specific defines
  4. *
  5. * Copyright (C) 1996-2012 Markus F.X.J. Oberhumer <markus@oberhumer.com>
  6. *
  7. * The full LZO package can be found at:
  8. * http://www.oberhumer.com/opensource/lzo/
  9. *
  10. * Changed for Linux kernel use by:
  11. * Nitin Gupta <nitingupta910@gmail.com>
  12. * Richard Purdie <rpurdie@openedhand.com>
  13. */
  14. #define COPY4(dst, src) \
  15. put_unaligned(get_unaligned((const u32 *)(src)), (u32 *)(dst))
  16. #if defined(__x86_64__)
  17. #define COPY8(dst, src) \
  18. put_unaligned(get_unaligned((const u64 *)(src)), (u64 *)(dst))
  19. #else
  20. #define COPY8(dst, src) \
  21. COPY4(dst, src); COPY4((dst) + 4, (src) + 4)
  22. #endif
  23. #if defined(__BIG_ENDIAN) && defined(__LITTLE_ENDIAN)
  24. #error "conflicting endian definitions"
  25. #elif defined(__x86_64__)
  26. #define LZO_USE_CTZ64 1
  27. #define LZO_USE_CTZ32 1
  28. #elif defined(__i386__) || defined(__powerpc__)
  29. #define LZO_USE_CTZ32 1
  30. #elif defined(__arm__) && (__LINUX_ARM_ARCH__ >= 5)
  31. #define LZO_USE_CTZ32 1
  32. #endif
  33. #define M1_MAX_OFFSET 0x0400
  34. #define M2_MAX_OFFSET 0x0800
  35. #define M3_MAX_OFFSET 0x4000
  36. #define M4_MAX_OFFSET 0xbfff
  37. #define M1_MIN_LEN 2
  38. #define M1_MAX_LEN 2
  39. #define M2_MIN_LEN 3
  40. #define M2_MAX_LEN 8
  41. #define M3_MIN_LEN 3
  42. #define M3_MAX_LEN 33
  43. #define M4_MIN_LEN 3
  44. #define M4_MAX_LEN 9
  45. #define M1_MARKER 0
  46. #define M2_MARKER 64
  47. #define M3_MARKER 32
  48. #define M4_MARKER 16
  49. #define lzo_dict_t unsigned short
  50. #define D_BITS 13
  51. #define D_SIZE (1u << D_BITS)
  52. #define D_MASK (D_SIZE - 1)
  53. #define D_HIGH ((D_MASK >> 1) + 1)