zstd/lib/common
Yann Collet 05dffe43a7 Fixed Btree update
ZSTD_updateTree() expected to be followed by a Bt match finder, which would update zc->nextToUpdate.
With the new optimal match finder, it's not necessarily the case : a match might be found during repcode or hash3, and stops there because it reaches sufficient_len, without even entering the binary tree.
Previous policy was to nonetheless update zc->nextToUpdate, but the current position would not be inserted, creating "holes" in the btree, aka positions that will no longer be searched.
Now, when current position is not inserted, zc->nextToUpdate is not update, expecting ZSTD_updateTree() to fill the tree later on.

Solution selected is that ZSTD_updateTree() takes care of properly setting zc->nextToUpdate,
so that it no longer depends on a future function to do this job.

It took time to get there, as the issue started with a memory sanitizer error.
The pb would have been easier to spot with a proper `assert()`.
So this patch add a few of them.

Additionnally, I discovered that `make test` does not enable `assert()` during CLI tests.
This patch enables them.

Unfortunately, these `assert()` triggered other (unrelated) bugs during CLI tests, mostly within zstdmt.
So this patch also fixes them.

- Changed packed structure for gcc memory access : memory sanitizer would complain that a read "might" reach out-of-bound position on the ground that the `union` is larger than the type accessed.
  Now, to avoid this issue, each type is independent.
- ZSTD_CCtxParams_setParameter() : @return provides the value of parameter, clamped/fixed appropriately.
- ZSTDMT : changed constant name to ZSTDMT_JOBSIZE_MIN
- ZSTDMT : multithreading is automatically disabled when srcSize <= ZSTDMT_JOBSIZE_MIN, since only one thread will be used in this case (saves memory and runtime).
- ZSTDMT : nbThreads is automatically clamped on setting the value.
2017-11-16 12:18:56 -08:00
..
bitstream.h [bitstream] Allow adding 31 bits at a time 2017-09-19 13:57:33 -07:00
compiler.h updated license header 2017-09-08 00:09:23 -07:00
entropy_common.c minor code refactor in HUF module 2017-03-05 21:07:20 -08:00
error_private.c changed error code when pos<=size condition is not respected 2017-09-27 10:35:56 -07:00
error_private.h updated license header 2017-09-08 00:09:23 -07:00
fse.h fix proper naming on FSE_createCTable() arguments in fse.h 2017-09-30 11:08:50 -07:00
fse_decompress.c Merge pull request #796 from terrelln/is-error 2017-08-15 12:37:28 -07:00
huf.h Ensure dictionary Huff table can encode any symbol 2017-10-03 13:22:13 -07:00
mem.h Fixed Btree update 2017-11-16 12:18:56 -08:00
pool.c removed direct call to malloc() from pool.c 2017-10-31 17:43:24 -07:00
pool.h updated license header 2017-09-08 00:09:23 -07:00
threading.c [libzstd] pthread function prefixed with ZSTD_ 2017-09-27 11:48:48 -07:00
threading.h [libzstd] pthread function prefixed with ZSTD_ 2017-09-27 11:48:48 -07:00
xxhash.c [libzstd] Fix FORCE_INLINE macro 2017-08-14 21:12:05 -07:00
xxhash.h xxhash can be included twice in any order 2017-03-01 13:29:29 -08:00
zstd_common.c merged repcode search into BT match search 2017-11-13 02:23:48 -08:00
zstd_errors.h changed error code when pos<=size condition is not respected 2017-09-27 10:35:56 -07:00
zstd_internal.h merged rep search into btMatchSearch 2017-11-14 20:38:52 -08:00