zstd: Fix reuse of huff0 when data hard to compress by klauspost · Pull Request #173 · klauspost/compress (original) (raw)

zstd would reject huff0 compressed literals if the improvement was too small.

However, this would update the huff0 state to contain a new table which could be reused. In that case a wrong table could be used for the next block.

We move the rejection code to huff0, so the state can be properly maintained.

Fixes #170