]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Renamed cover and fast cover hash functions/vars 2212/head
authorCarl Woffenden <cwoffenden@gmail.com>
Mon, 22 Jun 2020 09:54:24 +0000 (11:54 +0200)
committerCarl Woffenden <cwoffenden@gmail.com>
Mon, 22 Jun 2020 09:54:24 +0000 (11:54 +0200)
lib/dictBuilder/cover.c
lib/dictBuilder/fastcover.c

index fb453f8df6c72211e81ecc6a6e0b33b59f4e2123..50217c13d8befe62532b87a888502abd6b96182e 100644 (file)
@@ -129,9 +129,9 @@ static int COVER_map_init(COVER_map_t *map, U32 size) {
 /**
  * Internal hash function
  */
-static const U32 prime4bytes = 2654435761U;
+static const U32 COVER_prime4bytes = 2654435761U;
 static U32 COVER_map_hash(COVER_map_t *map, U32 key) {
-  return (key * prime4bytes) >> (32 - map->sizeLog);
+  return (key * COVER_prime4bytes) >> (32 - map->sizeLog);
 }
 
 /**
index a3be4c266c24935de33b70541033d84ee04a1323..520ca19295dee15b3f95985cb4be1eacb9762124 100644 (file)
@@ -75,15 +75,15 @@ static clock_t g_time = 0;
 
 
 /*-*************************************
-* Hash Functions
+* Hash Functions (matching zstd_compress_internal.h)
 ***************************************/
-static const U64 prime6bytes = 227718039650203ULL;
-static size_t ZSTD_hash6(U64 u, U32 h) { return (size_t)(((u  << (64-48)) * prime6bytes) >> (64-h)) ; }
-static size_t ZSTD_hash6Ptr(const void* p, U32 h) { return ZSTD_hash6(MEM_readLE64(p), h); }
+static const U64 FASTCOVER_prime6bytes = 227718039650203ULL;
+static size_t FASTCOVER_hash6(U64 u, U32 h) { return (size_t)(((u  << (64-48)) * FASTCOVER_prime6bytes) >> (64-h)) ; }
+static size_t FASTCOVER_hash6Ptr(const void* p, U32 h) { return FASTCOVER_hash6(MEM_readLE64(p), h); }
 
-static const U64 prime8bytes = 0xCF1BBCDCB7A56463ULL;
-static size_t ZSTD_hash8(U64 u, U32 h) { return (size_t)(((u) * prime8bytes) >> (64-h)) ; }
-static size_t ZSTD_hash8Ptr(const void* p, U32 h) { return ZSTD_hash8(MEM_readLE64(p), h); }
+static const U64 FASTCOVER_prime8bytes = 0xCF1BBCDCB7A56463ULL;
+static size_t FASTCOVER_hash8(U64 u, U32 h) { return (size_t)(((u) * FASTCOVER_prime8bytes) >> (64-h)) ; }
+static size_t FASTCOVER_hash8Ptr(const void* p, U32 h) { return FASTCOVER_hash8(MEM_readLE64(p), h); }
 
 
 /**
@@ -91,9 +91,9 @@ static size_t ZSTD_hash8Ptr(const void* p, U32 h) { return ZSTD_hash8(MEM_readLE
  */
 static size_t FASTCOVER_hashPtrToIndex(const void* p, U32 h, unsigned d) {
   if (d == 6) {
-    return ZSTD_hash6Ptr(p, h) & ((1 << h) - 1);
+    return FASTCOVER_hash6Ptr(p, h) & ((1 << h) - 1);
   }
-  return ZSTD_hash8Ptr(p, h) & ((1 << h) - 1);
+  return FASTCOVER_hash8Ptr(p, h) & ((1 << h) - 1);
 }