summaryrefslogtreecommitdiffstats
path: root/lib/lz4.c
Commit message (Collapse)AuthorAgeFilesLines
* clarify static sizes of states for static allocationYann Collet2022-07-121-6/+5
|
* silence a useless MSVC warningYann Collet2022-07-041-0/+1
|
* API: add `LZ4_decompress_safe_partial_usingDict` APIQi Wang2022-06-071-1/+48
| | | | | | feature request: #1051 Signed-off-by: Qi Wang <wangqi@linux.alibaba.com>
* Introduce MIN and MAX bounds to LZ4_MEMORY_USAGEYann Collet2022-01-311-1/+1
| | | | | | | ensure that `frametest` works fine with these values, notably with low LZ4_MEMORY_USAGE (dict test notably) following suggestions from @t-mat at #1016
* renamed unaligned -> LZ4_unalignedYann Collet2022-01-291-6/+6
| | | | | better name space isolation suggested by @boris-kolpackov in #1053
* Add commentsBen Niu2022-01-271-0/+5
|
* Disable _tzcnt_u64 for ARM64ECBen Niu2022-01-271-1/+1
| | | The ARM64EC is a new Microsoft-designed ARM64 ABI that is compatible with AMD64 code. However, not all AMD64 intrinsic functions are supported. For, intrinsics that are lowered to AVX, AVX2 and AVX512 instructions are not supported, including the _tzcnt_u64. To make sure this file compiles for ARM64EC, the use of _tzcnt_u64 should be neutered.
* Enable fast decoding on Apple/AArch64 buildsArseny Kapoulkine2021-11-221-3/+5
| | | | | | | | | | | This makes decoding significantly faster on M1; measured on compressed source code across 8 hardware threads, decompressing 294 MB to 1301 MB takes 513 ms of cumulative work (2.53 GB/s) before, and 406 ms (3.2 GB/s) after this change on M1 Pro. There's no way to check if the target architecture is M1 specifically but the gains are likely to be similar on recent iterations on Apple processors, and the original performance issue was probably more specific to Qualcomm.
* fix clang-cl _tzcnt_u64 not defined issueZeyi (Rice) Fan2021-08-091-0/+6
|
* Cast ALLOC return value to satisfy C++Gabe Jones2021-06-151-1/+1
|
* fix NULL ptr arithmetic at lz4:2299Yann Collet2021-05-281-2/+7
|
* fix NULL ptr arithmetic in lz4:1680Yann Collet2021-05-281-3/+6
| | | | only do arithmetic if offset > 0
* fix UB lz4:988 and lz4:1178Yann Collet2021-05-281-28/+38
| | | | | ensure `dictBase` is only used when there is an actual dictionary content.
* fix NULL ptr arithmetic of lz4:1572Yann Collet2021-05-281-5/+5
| | | | was blindly adding an offset (0) to `dictionary` which could be `NULL`.
* Fix potential memory corruption with negative memmove() sizeJasper Lievisse Adriaanse2021-02-261-1/+1
|
* fix some typos (work by Andrea Gelmini)Thomas Waldmann2021-01-071-1/+1
|
* fix minor header dateYann Collet2020-12-011-1/+1
|
* better visual conformanceYann Collet2020-11-151-4/+3
| | | | | | only include <intrin.h> on vs2005+ (#947) remove some useless #pragma fix a few minor Visual warnings
* restrict BitScanForward() to VS2005+Yann Collet2020-11-141-1/+1
| | | | suggested by @aqrit in #947
* changed LZ4_calloc() to a 2-arguments signatureYann Collet2020-11-091-2/+2
| | | | | | to remain similar to stdlib's calloc(). Updated test to use c++ compiler for stricter signature check.
* Merge branch 'dev' into customMemYann Collet2020-11-091-2/+2
|\
| * Merge pull request #944 from lz4/fix874Yann Collet2020-11-091-1/+1
| |\ | | | | | | fix #874
| | * fix #874Yann Collet2020-11-081-1/+1
| | | | | | | | | | | | | | | | | | | | | coverity reported a warning regarding a memcpy() overwrite. This is a false positive (the memory area is large enough), but it's true that it's not trivial to determine (encompassing struct), and it's proper anyway to only memcpy() just the right amount of data.
| * | fixed remaining ubsan warningsYann Collet2020-11-091-1/+1
| |/
* | first proposal for LZ4_USER_MEMORY_FUNCTIONSYann Collet2020-11-091-4/+17
|/ | | | | | | | | makes it possible to replace at link time malloc, calloc and free by user-provided functions which must be named LZ4_malloc(), LZ4_calloc() and LZ4_free(). answer #937
* fix minor UBsYann Collet2020-11-081-1/+3
| | | | | - check alignment before casting a pointer - saveDict : don't memmove() on NULL dst
* Merge pull request #941 from lz4/revertinlineYann Collet2020-11-081-18/+18
|\ | | | | Revert "Replace "static" to "LZ4_FORCE_INLINE" for small functions"
| * Revert "Replace "static" to "LZ4_FORCE_INLINE" for small functions"Yann Collet2020-11-071-18/+18
| | | | | | | | This reverts commit 0e3933edd435c54cc2e21e38f5d4ba7bf644a24e.
* | fix #935Yann Collet2020-11-071-2/+3
|/ | | | | | | minor: identical declaration and prototypes of `LZ4HC_compress_optimal()` also : very minor optimization of `LZ4_memcpy_using_offset()`
* Merge pull request #936 from lz4/alignTestYann Collet2020-11-071-12/+19
|\ | | | | More alignment tests
| * re-enable alignment test on all targetsYann Collet2020-11-071-14/+6
| |
| * unified alignment testYann Collet2020-11-061-9/+24
| | | | | | | | across lz4.c and lz4hc.c
* | Replace "static" to "LZ4_FORCE_INLINE" for small functionsremittor2020-10-071-18/+18
| | | | | | | | The "static" specifier does not guarantee that the function will be inlined.
* | Replace define LZ4_FORCE_O2_INLINE_GCC_PPC64LE to LZ4_FORCE_INLINEremittor2020-10-071-18/+18
| | | | | | | | There is no reason to separate these two definitions!
* | Fix: The "inline" specifier do not use for LZ4_wildCopy8 and LZ4_wildCopy32remittor2020-10-061-1/+1
|/ | | | This problem was reproduced on MSVC 2015 (32-bit). Both functions were called using the operator "call".
* fix conversion warningYann Collet2020-09-301-5/+5
|
* fix minor static analyzer warningsYann Collet2020-09-301-17/+19
| | | | | detected by scan-build, cppcheck and advanved compilation flags fix #786
* Merge pull request #923 from lz4/fix784Yann Collet2020-09-281-9/+15
|\ | | | | fix efficiency of LZ4_compress_HC_destSize()
| * improved last literals run on LZ4_compress_destSizeYann Collet2020-09-281-2/+2
| | | | | | | | | | | | applying new more accurate formula from LZ4_compress_HC_destSize() also : fix some minor display issue in tests/frametest
| * ensure last match not too close to endYann Collet2020-09-281-6/+11
| | | | | | | | must respect MFLIMIT distance from oend
| * fix efficiency of LZ4_compress_HC_destSize()Yann Collet2020-09-281-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | LZ4_compress_HC_destSize() had a tendency to discard its last match when this match overflowed specified dstBuffer limit. The impact is generally moderate, but occasionally huge, typically when this last match is very large (such as compressing a bunch of zeroes). Issue #784 fixed for both Chain and Opt implementations. Added a unit test suggested by @remittor checking this topic.
* | Merge pull request #921 from lz4/doubleNullYann Collet2020-09-281-0/+1
|\ \ | | | | | | fix compressing into NULL
| * | fix compressing into NULLYann Collet2020-09-261-0/+1
| |/ | | | | | | | | fails properly bug discovered by oss-fuzz
* | Fix compilation with TinyCCAnton Kochkov2020-09-271-2/+2
|/
* fixed lz4frame with blocks of size 1Yann Collet2020-09-171-21/+19
| | | | properly track history
* added the actual code changeYann Collet2020-09-171-6/+53
|
* fix #783Yann Collet2020-08-271-16/+23
| | | | | | | | | | | | | | | | | LZ4_decompress_safe_partial() now also supports a scenario where nb_bytes_to_generate is <= block_decompressed_size And nb_bytes_to_read is >= block_compressed_size. Previously, the only supported scenario was nb_bytes_to_read == block_compress_size. Pay attention that, if nb_bytes_to_read is > block_compressed_size, then, necessarily, it requires that nb_bytes_to_generate is <= block_decompress_size. If both are larger, it will generate corrupted data.
* Merge branch 'dev' into extraInputYann Collet2020-08-271-55/+57
|\
| * added documentation about LZ4_FORCE_SW_BITCOUNTYann Collet2020-08-261-2/+19
| | | | | | | | | | Also : added memory-frugal software byte count for big endian 64-bit cpus. Disabled by default.
| * Merge pull request #898 from aqrit/aqrit-prefixlenYann Collet2020-08-241-45/+46
| |\ | | | | | | rejigger bit counting intrinsics