35#if defined(__cplusplus)
39#ifndef LZ4_H_2983827168210
40#define LZ4_H_2983827168210
85#ifndef LZ4LIB_VISIBILITY
86#if defined(__GNUC__) && (__GNUC__ >= 4)
87#define LZ4LIB_VISIBILITY __attribute__((visibility("default")))
89#define LZ4LIB_VISIBILITY
92#if defined(LZ4_DLL_EXPORT) && (LZ4_DLL_EXPORT == 1)
93#define LZ4LIB_API __declspec(dllexport) LZ4LIB_VISIBILITY
94#elif defined(LZ4_DLL_IMPORT) && (LZ4_DLL_IMPORT == 1)
96 __declspec(dllimport) \
101#define LZ4LIB_API LZ4LIB_VISIBILITY
116#if defined(LZ4_FREESTANDING) && (LZ4_FREESTANDING == 1)
117#define LZ4_HEAPMODE 0
118#define LZ4HC_HEAPMODE 0
119#define LZ4_STATIC_LINKING_ONLY_DISABLE_MEMORY_ALLOCATION 1
120#if !defined(LZ4_memcpy)
121#error "LZ4_FREESTANDING requires macro 'LZ4_memcpy'."
123#if !defined(LZ4_memset)
124#error "LZ4_FREESTANDING requires macro 'LZ4_memset'."
126#if !defined(LZ4_memmove)
127#error "LZ4_FREESTANDING requires macro 'LZ4_memmove'."
129#elif !defined(LZ4_FREESTANDING)
130#define LZ4_FREESTANDING 0
134#define LZ4_VERSION_MAJOR 1
135#define LZ4_VERSION_MINOR \
138#define LZ4_VERSION_RELEASE 0
140#define LZ4_VERSION_NUMBER \
141 (LZ4_VERSION_MAJOR * 100 * 100 + LZ4_VERSION_MINOR * 100 + \
144#define LZ4_LIB_VERSION LZ4_VERSION_MAJOR.LZ4_VERSION_MINOR.LZ4_VERSION_RELEASE
145#define LZ4_QUOTE(str) #str
146#define LZ4_EXPAND_AND_QUOTE(str) LZ4_QUOTE(str)
147#define LZ4_VERSION_STRING \
148 LZ4_EXPAND_AND_QUOTE(LZ4_LIB_VERSION)
169#ifndef LZ4_MEMORY_USAGE
170#define LZ4_MEMORY_USAGE LZ4_MEMORY_USAGE_DEFAULT
174#define LZ4_MEMORY_USAGE_MIN 10
175#define LZ4_MEMORY_USAGE_DEFAULT 14
176#define LZ4_MEMORY_USAGE_MAX 20
178#if (LZ4_MEMORY_USAGE < LZ4_MEMORY_USAGE_MIN)
179#error "LZ4_MEMORY_USAGE is too small !"
182#if (LZ4_MEMORY_USAGE > LZ4_MEMORY_USAGE_MAX)
183#error "LZ4_MEMORY_USAGE is too large !"
242#define LZ4_MAX_INPUT_SIZE 0x7E000000
243#define LZ4_COMPRESSBOUND(isize) \
244 ((unsigned)(isize) > (unsigned)LZ4_MAX_INPUT_SIZE \
246 : (isize) + ((isize) / 255) + 16)
383#if !defined(LZ4_STATIC_LINKING_ONLY_DISABLE_MEMORY_ALLOCATION)
510 const char *src,
char *dst,
538#if !defined(LZ4_STATIC_LINKING_ONLY_DISABLE_MEMORY_ALLOCATION)
553 const char *dictionary,
int dictSize);
567#define LZ4_DECODER_RING_BUFFER_SIZE(maxBlockSize) \
620 const char *src,
char *dst,
int srcSize,
674#ifdef LZ4_STATIC_LINKING_ONLY
676#ifndef LZ4_STATIC_3504398509
677#define LZ4_STATIC_3504398509
679#ifdef LZ4_PUBLISH_STATIC_FUNCTIONS
680#define LZ4LIB_STATIC_API LZ4LIB_API
682#define LZ4LIB_STATIC_API
762#define LZ4_DECOMPRESS_INPLACE_MARGIN(compressedSize) \
763 (((compressedSize) >> 8) + 32)
764#define LZ4_DECOMPRESS_INPLACE_BUFFER_SIZE(decompressedSize) \
765 ((decompressedSize) + \
766 LZ4_DECOMPRESS_INPLACE_MARGIN( \
772#ifndef LZ4_DISTANCE_MAX
774#define LZ4_DISTANCE_MAX 65535
777#define LZ4_COMPRESS_INPLACE_MARGIN \
778 (LZ4_DISTANCE_MAX + 32)
780#define LZ4_COMPRESS_INPLACE_BUFFER_SIZE(maxCompressedSize) \
781 ((maxCompressedSize) + \
782 LZ4_COMPRESS_INPLACE_MARGIN)
791#ifndef LZ4_H_98237428734687
792#define LZ4_H_98237428734687
802#define LZ4_HASHLOG (LZ4_MEMORY_USAGE - 2)
803#define LZ4_HASHTABLESIZE (1 << LZ4_MEMORY_USAGE)
804#define LZ4_HASH_SIZE_U32 \
807#if defined(__cplusplus) || \
808 (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) )
838#define LZ4_STREAM_MINSIZE \
839 ((1UL << (LZ4_MEMORY_USAGE)) + \
875#define LZ4_STREAMDECODE_MINSIZE 32
896#ifdef LZ4_DISABLE_DEPRECATE_WARNINGS
897#define LZ4_DEPRECATED(message)
899#if defined(__cplusplus) && (__cplusplus >= 201402)
900#define LZ4_DEPRECATED(message) [[deprecated(message)]]
901#elif defined(_MSC_VER)
902#define LZ4_DEPRECATED(message) __declspec(deprecated(message))
903#elif defined(__clang__) || \
904 (defined(__GNUC__) && (__GNUC__ * 10 + __GNUC_MINOR__ >= 45))
905#define LZ4_DEPRECATED(message) __attribute__((deprecated(message)))
906#elif defined(__GNUC__) && (__GNUC__ * 10 + __GNUC_MINOR__ >= 31)
907#define LZ4_DEPRECATED(message) __attribute__((deprecated))
910 "WARNING: LZ4_DEPRECATED needs custom implementation for this compiler")
911#define LZ4_DEPRECATED(message)
1038#if defined(__cplusplus)
int LZ4_compress_fast_extState_fastReset(void *state, const char *src, char *dst, int srcSize, int dstCapacity, int acceleration)
int LZ4_compress_destSize_extState(void *state, const char *src, char *dst, int *srcSizePtr, int targetDstSize, int acceleration)
int LZ4_decompress_fast_withPrefix64k(const char *src, char *dst, int originalSize)
#define LZ4_STREAMDECODE_MINSIZE
int LZ4_saveDict(LZ4_stream_t *streamPtr, char *safeBuffer, int maxDictSize)
int LZ4_decompress_fast_usingDict(const char *src, char *dst, int originalSize, const char *dictStart, int dictSize)
int LZ4_compress_fast(const char *src, char *dst, int srcSize, int dstCapacity, int acceleration)
int LZ4_compress_limitedOutput_continue(LZ4_stream_t *LZ4_streamPtr, const char *source, char *dest, int inputSize, int maxOutputSize)
int LZ4_freeStream(LZ4_stream_t *streamPtr)
int LZ4_compress_fast_extState(void *state, const char *src, char *dst, int srcSize, int dstCapacity, int acceleration)
int LZ4_compressBound(int inputSize)
int LZ4_decompress_safe_partial(const char *src, char *dst, int srcSize, int targetOutputSize, int dstCapacity)
int LZ4_compress_withState(void *state, const char *source, char *dest, int inputSize)
int LZ4_decoderRingBufferSize(int maxBlockSize)
int LZ4_compress_fast_continue(LZ4_stream_t *streamPtr, const char *src, char *dst, int srcSize, int dstCapacity, int acceleration)
int LZ4_compress_destSize(const char *src, char *dst, int *srcSizePtr, int targetDstSize)
int LZ4_sizeofState(void)
int LZ4_compress(const char *src, char *dest, int srcSize)
int LZ4_decompress_safe_partial_usingDict(const char *src, char *dst, int compressedSize, int targetOutputSize, int maxOutputSize, const char *dictStart, int dictSize)
const char * LZ4_versionString(void)
void LZ4_resetStream_fast(LZ4_stream_t *streamPtr)
#define LZ4_HASH_SIZE_U32
int LZ4_uncompress(const char *source, char *dest, int outputSize)
#define LZ4_STREAM_MINSIZE
char * LZ4_slideInputBuffer(void *state)
int LZ4_decompress_safe_withPrefix64k(const char *src, char *dst, int compressedSize, int maxDstSize)
void LZ4_resetStream(LZ4_stream_t *streamPtr)
int LZ4_decompress_fast(const char *src, char *dst, int originalSize)
int LZ4_uncompress_unknownOutputSize(const char *source, char *dest, int isize, int maxOutputSize)
int LZ4_compress_limitedOutput(const char *src, char *dest, int srcSize, int maxOutputSize)
int LZ4_loadDict(LZ4_stream_t *streamPtr, const char *dictionary, int dictSize)
int LZ4_sizeofStreamState(void)
int LZ4_setStreamDecode(LZ4_streamDecode_t *LZ4_streamDecode, const char *dictionary, int dictSize)
int LZ4_versionNumber(void)
LZ4_stream_t * LZ4_createStream(void)
int LZ4_compress_default(const char *src, char *dst, int srcSize, int dstCapacity)
int LZ4_compress_limitedOutput_withState(void *state, const char *source, char *dest, int inputSize, int maxOutputSize)
int LZ4_loadDictSlow(LZ4_stream_t *streamPtr, const char *dictionary, int dictSize)
LZ4_stream_t * LZ4_initStream(void *stateBuffer, size_t size)
int LZ4_decompress_safe_continue(LZ4_streamDecode_t *LZ4_streamDecode, const char *src, char *dst, int srcSize, int dstCapacity)
int LZ4_resetStreamState(void *state, char *inputBuffer)
int LZ4_decompress_safe(const char *src, char *dst, int compressedSize, int dstCapacity)
void LZ4_attach_dictionary(LZ4_stream_t *workingStream, const LZ4_stream_t *dictionaryStream)
int LZ4_compress_continue(LZ4_stream_t *LZ4_streamPtr, const char *source, char *dest, int inputSize)
int LZ4_decompress_safe_usingDict(const char *src, char *dst, int srcSize, int dstCapacity, const char *dictStart, int dictSize)
int LZ4_decompress_fast_continue(LZ4_streamDecode_t *LZ4_streamDecode, const char *src, char *dst, int originalSize)
#define LZ4_DEPRECATED(message)
int LZ4_freeStreamDecode(LZ4_streamDecode_t *LZ4_stream)
LZ4_streamDecode_t * LZ4_createStreamDecode(void)
void * LZ4_create(char *inputBuffer)
const LZ4_stream_t_internal * dictCtx
LZ4_u32 hashTable[(1<<(14 - 2))]
const LZ4_byte * dictionary
LZ4_streamDecode_t_internal internal_donotuse
LZ4_stream_t_internal internal_donotuse
char minStateSize[((1UL<<(14))+32)]