summaryrefslogtreecommitdiffstats
path: root/lib/lz4.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/lz4.c')
-rw-r--r--lib/lz4.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/lz4.c b/lib/lz4.c
index dd0ed4b..17477a5 100644
--- a/lib/lz4.c
+++ b/lib/lz4.c
@@ -514,7 +514,7 @@ static unsigned LZ4_NbCommonBytes (reg_t val)
return (unsigned)r >> 3;
# elif (defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 3) || \
((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))))) && \
- !defined(LZ4_FORCE_SW_BITCOUNT)
+ !defined(__TINYC__) && !defined(LZ4_FORCE_SW_BITCOUNT)
return (unsigned)__builtin_ctz((U32)val) >> 3;
# else
const U32 m = 0x01010101;
@@ -525,7 +525,7 @@ static unsigned LZ4_NbCommonBytes (reg_t val)
if (sizeof(val)==8) {
# if (defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 3) || \
((__GNUC__ == 3) && (__GNUC_MINOR__ >= 4))))) && \
- !defined(LZ4_FORCE_SW_BITCOUNT)
+ !defined(__TINYC__) && !defined(LZ4_FORCE_SW_BITCOUNT)
return (unsigned)__builtin_clzll((U64)val) >> 3;
# else
#if 1
@@ -1237,6 +1237,7 @@ LZ4_FORCE_INLINE int LZ4_compress_generic(
if ((U32)srcSize > (U32)LZ4_MAX_INPUT_SIZE) { return 0; } /* Unsupported srcSize, too large (or negative) */
if (srcSize == 0) { /* src == NULL supported if srcSize == 0 */
+ if (outputDirective != notLimited && dstCapacity <= 0) return 0; /* no output, can't write anything */
DEBUGLOG(5, "Generating an empty block");
assert(outputDirective == notLimited || dstCapacity >= 1);
assert(dst != NULL);