Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.4 KiB

  1. /*
  2. * fastenc.h
  3. *
  4. * Defines for the fast encoder
  5. */
  6. //
  7. // Size of hash table for std encoder
  8. //
  9. #define FAST_ENCODER_HASH_TABLE_SIZE 2048
  10. #define FAST_ENCODER_HASH_MASK (FAST_ENCODER_HASH_TABLE_SIZE-1)
  11. #define FAST_ENCODER_HASH_SHIFT 4
  12. #define FAST_ENCODER_RECALCULATE_HASH(loc) \
  13. (((window[loc] << (2*FAST_ENCODER_HASH_SHIFT)) ^ \
  14. (window[loc+1] << FAST_ENCODER_HASH_SHIFT) ^ \
  15. (window[loc+2])) & FAST_ENCODER_HASH_MASK)
  16. //
  17. // Be very careful about increasing the window size; the code tables will have to
  18. // be updated, since they assume that extra_distance_bits is never larger than a
  19. // certain size.
  20. //
  21. #define FAST_ENCODER_WINDOW_SIZE 8192
  22. #define FAST_ENCODER_WINDOW_MASK (FAST_ENCODER_WINDOW_SIZE - 1)
  23. //
  24. // Don't take a match 3 further away than this
  25. //
  26. #define FAST_ENCODER_MATCH3_DIST_THRESHOLD 16384
  27. typedef struct fast_encoder
  28. {
  29. // history window
  30. BYTE window[2*FAST_ENCODER_WINDOW_SIZE + MAX_MATCH + 4];
  31. // next most recent occurance of chars with same hash value
  32. t_search_node prev[FAST_ENCODER_WINDOW_SIZE + MAX_MATCH];
  33. // hash table to find most recent occurance of chars with same hash value
  34. t_search_node lookup[FAST_ENCODER_HASH_TABLE_SIZE];
  35. // have we output our block header (the whole data file will be one big dynamic block)?
  36. BOOL fOutputBlockHeader;
  37. } t_fast_encoder;