summaryrefslogtreecommitdiffstats
path: root/lz4.h
diff options
context:
space:
mode:
authoryann.collet.73@gmail.com <yann.collet.73@gmail.com@650e7d94-2a16-8b24-b05c-7c0b3f6821cd>2012-11-30 13:23:36 (GMT)
committeryann.collet.73@gmail.com <yann.collet.73@gmail.com@650e7d94-2a16-8b24-b05c-7c0b3f6821cd>2012-11-30 13:23:36 (GMT)
commitffb27d4eca6bd80c068e745388faa31a0982115c (patch)
treee757f211b19929628b6d50e31e7b23a6ef343f35 /lz4.h
parent43a03b41b26817a034301c54546638267462ecec (diff)
downloadlz4-ffb27d4eca6bd80c068e745388faa31a0982115c.zip
lz4-ffb27d4eca6bd80c068e745388faa31a0982115c.tar.gz
lz4-ffb27d4eca6bd80c068e745388faa31a0982115c.tar.bz2
LZ4 HC : extended detection window. Thanks to Adrien Grand.
Fuzzer : more tests cases lz4demo : detect write errors. Thanks to Dima Tisnek bench.c : compatibility with Solaris 64. Thanks to Thorbjørn Willoch LZ4_compressBound() : now both in inline function and macro format. Thanks to Jacob Gorm Hansen git-svn-id: https://lz4.googlecode.com/svn/trunk@84 650e7d94-2a16-8b24-b05c-7c0b3f6821cd
Diffstat (limited to 'lz4.h')
-rw-r--r--lz4.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/lz4.h b/lz4.h
index dee3984..3680121 100644
--- a/lz4.h
+++ b/lz4.h
@@ -38,6 +38,14 @@ extern "C" {
#endif
+//**************************************
+// Compiler Options
+//**************************************
+#ifdef _MSC_VER // Visual Studio
+# define inline __inline // Visual is not C99, but supports some kind of inline
+#endif
+
+
//****************************
// Simple Functions
//****************************
@@ -50,7 +58,7 @@ LZ4_compress() :
Compresses 'isize' bytes from 'source' into 'dest'.
Destination buffer must be already allocated,
and must be sized to handle worst cases situations (input data not compressible)
- Worst case size evaluation is provided by macro LZ4_compressBound()
+ Worst case size evaluation is provided by function LZ4_compressBound()
isize : is the input size. Max supported value is ~1.9GB
return : the number of bytes written in buffer dest
@@ -70,12 +78,15 @@ LZ4_uncompress() :
// Advanced Functions
//****************************
-#define LZ4_compressBound(isize) (isize + (isize/255) + 16)
+static inline int LZ4_compressBound(int isize) { return ((isize) + ((isize)/255) + 16); }
+#define LZ4_COMPRESSBOUND( isize) ((isize) + ((isize)/255) + 16)
/*
LZ4_compressBound() :
Provides the maximum size that LZ4 may output in a "worst case" scenario (input data not compressible)
primarily useful for memory allocation of output buffer.
+ inline function is recommended for the general case,
+ but macro is also provided when results need to be evaluated at compile time (such as table size allocation).
isize : is the input size. Max supported value is ~1.9GB
return : maximum output size in a "worst case" scenario