]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Allow HASH_ONLY_EVERY_LOG to be configured in ldm.h
authorStella Lau <laus@fb.com>
Wed, 26 Jul 2017 23:43:25 +0000 (16:43 -0700)
committerStella Lau <laus@fb.com>
Wed, 26 Jul 2017 23:43:25 +0000 (16:43 -0700)
contrib/long_distance_matching/Makefile
contrib/long_distance_matching/ldm.c
contrib/long_distance_matching/ldm.h

index 8bc7ac4786042fd72c78a6d1774f00c78b463838..4193cb3234ad150338fe04b2bb12af1bc2476d22 100644 (file)
@@ -32,6 +32,6 @@ ldm: ldm_common.c ldm.c main.c
 
 clean:
        @rm -f core *.o tmp* result* *.ldm *.ldm.dec \
-       ldm     
+       ldm
        @echo Cleaning completed
 
index 9a8438383c6db9a3ab5fb3a87c07bec74cdb217c..25bf5c838a095e21c15b45fc553c4570e8ae2de3 100644 (file)
   #define LDM_HASH_ENTRY_SIZE_LOG 2
 #endif
 
-// Force the "probability" of insertion to be some value.
 // Entries are inserted into the table HASH_ONLY_EVERY + 1 times "on average".
+#ifndef HASH_ONLY_EVERY_LOG
+  #define HASH_ONLY_EVERY_LOG (LDM_WINDOW_SIZE_LOG-((LDM_MEMORY_USAGE)-(LDM_HASH_ENTRY_SIZE_LOG)))
+#endif
 
-//#define HASH_ONLY_EVERY_LOG 7
-#define HASH_ONLY_EVERY_LOG (LDM_WINDOW_SIZE_LOG-((LDM_MEMORY_USAGE)-(LDM_HASH_ENTRY_SIZE_LOG)))
 #define HASH_ONLY_EVERY ((1 << (HASH_ONLY_EVERY_LOG)) - 1)
 
 #define HASH_BUCKET_SIZE (1 << (HASH_BUCKET_SIZE_LOG))
index 38d240152c3cc9f00e771710bcd8b45d7cf30a9a..af35130ebcac674232924b90f24136bca6246514 100644 (file)
@@ -3,7 +3,7 @@
 
 #include "mem.h"    // from /lib/common/mem.h
 
-// #include "ldm_params.h"
+//#include "ldm_params.h"
 
 // =============================================================================
 // Modify the parameters in ldm_params.h if "ldm_params.h" is included.
@@ -23,7 +23,7 @@
   #define LDM_LAG 0
 
   // The maximum window size when searching for matches.
-  // The maximum value is 30.
+  // The maximum value is 30
   #define LDM_WINDOW_SIZE_LOG 28
 
   // The minimum match length.
 // Output the configuration.
 #define OUTPUT_CONFIGURATION
 
+// If defined, forces the probability of insertion to be approximately
+// one per (1 << HASH_ONLY_EVERY_LOG). If not defined, the probability will be
+// calculated based on the memory usage and window size for "even" insertion
+// throughout the window.
+
+// #define HASH_ONLY_EVERY_LOG 8
+
 // =============================================================================
 
 // The number of bytes storing the compressed and decompressed size