From 6716325ae8db3f177630c875622401e35e4a84e5 Mon Sep 17 00:00:00 2001 From: "W. Felix Handte" Date: Thu, 8 Mar 2018 12:30:34 -0500 Subject: [PATCH] Remove Switch In Favor of Ternary Statement --- lib/lz4.c | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/lib/lz4.c b/lib/lz4.c index da68ddd7..809faf9e 100644 --- a/lib/lz4.c +++ b/lib/lz4.c @@ -605,27 +605,11 @@ LZ4_FORCE_INLINE int LZ4_compress_generic( /* Init conditions */ if ((U32)inputSize > (U32)LZ4_MAX_INPUT_SIZE) return 0; /* Unsupported inputSize, too large (or negative) */ - switch(dictDirective) - { - case noDict: - default: - lowLimit = (const BYTE*)source; - break; - case withPrefix64k: - lowLimit = (const BYTE*)source - dictSize; - break; - case usingExtDict: - lowLimit = (const BYTE*)source; - break; - case usingExtDictCtx: - lowLimit = (const BYTE*)source; - break; - } + lowLimit = (const BYTE*)source - (dictDirective == withPrefix64k ? dictSize : 0); dictLowLimit = dictionary ? dictionary : lowLimit; if ((tableType == byU16) && (inputSize>=LZ4_64Klimit)) return 0; /* Size too large (not within 64K limit) */ - if (inputSize