lhx_decoder.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. Copyright (c) 2011, 2012, 2013, Simon Howard
  3. Permission to use, copy, modify, and/or distribute this software
  4. for any purpose with or without fee is hereby granted, provided
  5. that the above copyright notice and this permission notice appear
  6. in all copies.
  7. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  8. WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  9. WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  10. AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
  11. CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  12. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
  13. NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  14. CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. //
  17. // Decoder for the -lhx- algorithm. Provided by Multi.
  18. //
  19. // -lhx- is Unlha32.dll's original extension. Some unique archivers
  20. // support it.
  21. //
  22. // 128 KiB history ring buffer:
  23. // -lhx-'s maximum dictionary size is 2^19. 2x ring buffer is required.
  24. #define HISTORY_BITS 20 /* 2^20 = 1048576. */
  25. // Number of bits to encode HISTORY_BITS:
  26. #define OFFSET_BITS 5
  27. // Name of the variable for the encoder:
  28. #define DECODER_NAME lha_lhx_decoder
  29. // The actual algorithm code is contained in lh_new_decoder.c, which
  30. // acts as a template for -lh4-, -lh5-, -lh6-, -lh7- and -lhx-.
  31. #include "lh_new_decoder.c"