From 2ce0e5ad9b4c25265af2176054c7f80cbfdc2b6d Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sat, 14 Nov 2026 13:42:21 +0100 Subject: [PATCH] Bump LZ4 to 1.11.1. --- public/common/tracy_lz4.cpp | 6 ++++-- public/common/tracy_lz4.hpp | 8 ++++---- public/common/tracy_lz4hc.cpp | 12 +++++++++--- public/common/tracy_lz4hc.hpp | 10 ++++++---- 4 files changed, 23 insertions(+), 13 deletions(-) diff --git a/public/common/tracy_lz4.cpp b/public/common/tracy_lz4.cpp index 035e2f90..5d4b1828 100644 --- a/public/common/tracy_lz4.cpp +++ b/public/common/tracy_lz4.cpp @@ -482,6 +482,8 @@ static const int dec64table[8] = {0, 0, 0, -1, -4, 1, 2, 3}; # define LZ4_FAST_DEC_LOOP 1 # elif defined(__aarch64__) # define LZ4_FAST_DEC_LOOP 1 +# elif defined(__PPC64__) +# define LZ4_FAST_DEC_LOOP 1 # elif defined(__riscv) && (__riscv_xlen == 64) && defined(__riscv_misaligned_fast) # define LZ4_FAST_DEC_LOOP 1 /* otherwise, unaligned memcpy() become byte copies, defeating the fast loop */ # else @@ -519,11 +521,11 @@ LZ4_memcpy_using_offset_base(BYTE* dstPtr, const BYTE* srcPtr, BYTE* dstEnd, con #if LZ4_FAST_DEC_LOOP -/* LZ4_wildCopy64 is faster on aarch64 and x86-64, but not on 32-bit x86. +/* LZ4_wildCopy64 is faster on aarch64, x86-64 and ppc64, but not on 32-bit x86. * On wasm, it depends on the host cpu (faster on Apple silicon, slower on x86-64) : * it's not enabled by default, but can be, with LZ4_FAST_DEC_LOOP, from the build command */ #ifndef LZ4_WILDCOPY64 -# if defined(__aarch64__) || defined(__x86_64__) || defined(_M_X64) +# if defined(__aarch64__) || defined(__x86_64__) || defined(_M_X64) || defined(__PPC64__) # define LZ4_WILDCOPY64 1 # else # define LZ4_WILDCOPY64 0 diff --git a/public/common/tracy_lz4.hpp b/public/common/tracy_lz4.hpp index e31fb961..4136037f 100644 --- a/public/common/tracy_lz4.hpp +++ b/public/common/tracy_lz4.hpp @@ -128,7 +128,7 @@ /*------ Version ------*/ #define LZ4_VERSION_MAJOR 1 /* for breaking interface changes */ #define LZ4_VERSION_MINOR 11 /* for new (non-breaking) interface capabilities */ -#define LZ4_VERSION_RELEASE 0 /* for tweaks, bug-fixes, or development */ +#define LZ4_VERSION_RELEASE 1 /* for tweaks, bug-fixes, or development */ #define LZ4_VERSION_NUMBER (LZ4_VERSION_MAJOR *100*100 + LZ4_VERSION_MINOR *100 + LZ4_VERSION_RELEASE) @@ -863,10 +863,10 @@ LZ4_DEPRECATED("This function is deprecated and unsafe. Consider using LZ4_decom LZ4LIB_API int LZ4_decompress_fast_usingDict (const char* src, char* dst, int originalSize, const char* dictStart, int dictSize); /*! LZ4_resetStream() : deprecated (v1.11.0) - * Same as LZ4_initStream(streamPtr, sizeof(LZ4_stream_t)) : prefer LZ4_initStream(). - * To start a new stream with an initialized state, LZ4_resetStream_fast() is faster. + * LZ4_resetStream(s) is replaced by LZ4_initStream(s, sizeof(*s)) : same behavior, @s may contain garbage. + * To start a new stream on an already initialized state, LZ4_resetStream_fast(s) is faster. */ -LZ4_DEPRECATED("use LZ4_initStream() instead") LZ4LIB_API void LZ4_resetStream (LZ4_stream_t* streamPtr); +LZ4_DEPRECATED("use LZ4_initStream(s, sizeof(*s)) instead") LZ4LIB_API void LZ4_resetStream (LZ4_stream_t* streamPtr); } diff --git a/public/common/tracy_lz4hc.cpp b/public/common/tracy_lz4hc.cpp index af07130f..2f4a94e9 100644 --- a/public/common/tracy_lz4hc.cpp +++ b/public/common/tracy_lz4hc.cpp @@ -43,9 +43,15 @@ * allocate memory for their workspace: * in stack (0:fastest), or in heap (1:default, requires malloc()). * Since workspace is rather large, heap mode is recommended. + * Stack mode is the default when memory allocation is disabled + * (LZ4_STATIC_LINKING_ONLY_DISABLE_MEMORY_ALLOCATION, see lz4.c). **/ #ifndef LZ4HC_HEAPMODE -# define LZ4HC_HEAPMODE 1 +# if defined(LZ4_STATIC_LINKING_ONLY_DISABLE_MEMORY_ALLOCATION) +# define LZ4HC_HEAPMODE 0 +# else +# define LZ4HC_HEAPMODE 1 +# endif #endif @@ -1691,10 +1697,10 @@ static size_t LZ4HC_sizeofState(const LZ4_streamHC_t* s) return s->internal_donotuse.hasWorkspace ? LZ4_STREAMHC_EXTSIZE : sizeof(*s); } -/* just a stub */ +/* initializes arbitrary data, as LZ4_initStreamHC() : its extension marker can't be trusted */ void LZ4_resetStreamHC (LZ4_streamHC_t* LZ4_streamHCPtr, int compressionLevel) { - LZ4_initStreamHC(LZ4_streamHCPtr, LZ4HC_sizeofState(LZ4_streamHCPtr)); + LZ4_initStreamHC(LZ4_streamHCPtr, sizeof(*LZ4_streamHCPtr)); LZ4_setCompressionLevel(LZ4_streamHCPtr, compressionLevel); } diff --git a/public/common/tracy_lz4hc.hpp b/public/common/tracy_lz4hc.hpp index 7457b753..925e0a6b 100644 --- a/public/common/tracy_lz4hc.hpp +++ b/public/common/tracy_lz4hc.hpp @@ -293,11 +293,13 @@ LZ4LIB_API LZ4_streamHC_t* LZ4_initStreamHC(void* buffer, size_t size); * LZ4_slideInputBufferHC() */ /* LZ4_resetStreamHC() : deprecated (v1.11.0) - * Replaced by LZ4_initStreamHC(), which initializes a memory segment containing arbitrary garbage data, - * followed by LZ4_resetStreamHC_fast() to select the compression level. - * LZ4_resetStreamHC_fast() alone is the recommended function to start a new stream of blocks. + * LZ4_resetStreamHC(s, level) is replaced by : + * LZ4_initStreamHC(s, sizeof(*s)); + * LZ4_resetStreamHC_fast(s, level); + * Same behavior : @s may contain garbage, and is initialized as a state of sizeof(LZ4_streamHC_t) bytes. + * To start a new stream on an already initialized state, LZ4_resetStreamHC_fast(s, level) alone is faster. */ -LZ4_DEPRECATED("use LZ4_initStreamHC() and LZ4_resetStreamHC_fast() instead") LZ4LIB_API void LZ4_resetStreamHC (LZ4_streamHC_t* streamHCPtr, int compressionLevel); +LZ4_DEPRECATED("use LZ4_initStreamHC(s, sizeof(*s)) then LZ4_resetStreamHC_fast(s, level) instead") LZ4LIB_API void LZ4_resetStreamHC (LZ4_streamHC_t* streamHCPtr, int compressionLevel); }