summaryrefslogtreecommitdiffstats
path: root/programs/bench.c
diff options
context:
space:
mode:
authorJennifer Liu <jenniferliu620@fb.com>2018-06-27 20:36:38 (GMT)
committerJennifer Liu <jenniferliu620@fb.com>2018-06-27 20:36:38 (GMT)
commite778db373b67ce15311b783c49b1d054293ce2af (patch)
tree0a5093a3eb5a14c55b40bde4f8eb6c379522f257 /programs/bench.c
parent8745638d7c04bdfc33bcf656ed262c2588534db5 (diff)
downloadlz4-e778db373b67ce15311b783c49b1d054293ce2af.zip
lz4-e778db373b67ce15311b783c49b1d054293ce2af.tar.gz
lz4-e778db373b67ce15311b783c49b1d054293ce2af.tar.bz2
Fixed bugs about incorrect acceleration calculation and benchmarking negative compresion level
Diffstat (limited to 'programs/bench.c')
-rw-r--r--programs/bench.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/programs/bench.c b/programs/bench.c
index 770191c..9dc31c4 100644
--- a/programs/bench.c
+++ b/programs/bench.c
@@ -49,7 +49,10 @@
#include "lz4.h"
#define COMPRESSOR0 LZ4_compress_local
-static int LZ4_compress_local(const char* src, char* dst, int srcSize, int dstSize, int clevel) { (void)clevel; return LZ4_compress_default(src, dst, srcSize, dstSize); }
+static int LZ4_compress_local(const char* src, char* dst, int srcSize, int dstSize, int clevel) {
+ int const acceleration = (clevel < 0) ? -clevel + 1 : 1;
+ return LZ4_compress_fast(src, dst, srcSize, dstSize, acceleration);
+}
#include "lz4hc.h"
#define COMPRESSOR1 LZ4_compress_HC
#define DEFAULTCOMPRESSOR COMPRESSOR0