]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
guard functions using floating point for debug mode only 1471/head
authorYann Collet <cyan@fb.com>
Sat, 22 Dec 2018 17:09:40 +0000 (09:09 -0800)
committerYann Collet <cyan@fb.com>
Sat, 22 Dec 2018 17:09:40 +0000 (09:09 -0800)
they are only used to print debug messages.
Requested in #1386,

lib/compress/zstd_compress_internal.h
lib/compress/zstd_opt.c

index 798dad14f01ab92661542bd5112a51e7f0dd9760..3d31ed819e117e991f51d64d76e164230c361ffc 100644 (file)
@@ -746,6 +746,7 @@ MEM_STATIC U32 ZSTD_window_update(ZSTD_window_t* window,
 
 
 /* debug functions */
+#if (DEBUGLEVEL>=2)
 
 MEM_STATIC double ZSTD_fWeight(U32 rawStat)
 {
@@ -760,6 +761,8 @@ MEM_STATIC double ZSTD_fWeight(U32 rawStat)
     return (double)weight / fp_multiplier;
 }
 
+/* display a table content,
+ * listing each element, its frequency, and its predicted bit cost */
 MEM_STATIC void ZSTD_debugTable(const U32* table, U32 max)
 {
     unsigned u, sum;
@@ -771,6 +774,9 @@ MEM_STATIC void ZSTD_debugTable(const U32* table, U32 max)
     }
 }
 
+#endif
+
+
 #if defined (__cplusplus)
 }
 #endif
index 98079822f8c75b936cfe75c744828dabcade7784..d7e812a5eecff57aabc98f75993dd280b6b34700 100644 (file)
@@ -54,11 +54,15 @@ MEM_STATIC U32 ZSTD_fracWeight(U32 rawStat)
     return weight;
 }
 
-/* debugging function, @return price in bytes */
+#if (DEBUGLEVEL>=2)
+/* debugging function,
+ * @return price in bytes as fractional value
+ * for debug messages only */
 MEM_STATIC double ZSTD_fCost(U32 price)
 {
     return (double)price / (BITCOST_MULTIPLIER*8);
 }
+#endif
 
 static void ZSTD_setBasePrices(optState_t* optPtr, int optLevel)
 {