From: Yann Collet Date: Sat, 22 Dec 2018 17:09:40 +0000 (-0800) Subject: guard functions using floating point for debug mode only X-Git-Tag: v1.3.8~6^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c9dfb7e4457aa1027ad173246049343d03351b6c;p=thirdparty%2Fzstd.git guard functions using floating point for debug mode only they are only used to print debug messages. Requested in #1386, --- diff --git a/lib/compress/zstd_compress_internal.h b/lib/compress/zstd_compress_internal.h index 798dad14f..3d31ed819 100644 --- a/lib/compress/zstd_compress_internal.h +++ b/lib/compress/zstd_compress_internal.h @@ -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 diff --git a/lib/compress/zstd_opt.c b/lib/compress/zstd_opt.c index 98079822f..d7e812a5e 100644 --- a/lib/compress/zstd_opt.c +++ b/lib/compress/zstd_opt.c @@ -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) {