lkml.org 
[lkml]   [2020]   [Jun]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [PATCH] lib/lz4: smatch warning in LZ4_decompress_generic()
From
Date
On Mon, 2020-06-08 at 00:40 +0000, Yann Collet wrote:
> Hi Vasily
>
>
> If I do understand the discussion, the question is about usage of `&` instead of `&&`,
> and the speculation that it might be an error.
>
> It's not an error. Unfortunately, explaining the reasoning behind this decision is a bit long.

Likely better to add a comment around the use so that
another patch like this doesn't get submitted again.

Perhaps something like:
---
lib/lz4/lz4_decompress.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/lib/lz4/lz4_decompress.c b/lib/lz4/lz4_decompress.c
index 0c9d3ad17e0f..5371dab6b481 100644
--- a/lib/lz4/lz4_decompress.c
+++ b/lib/lz4/lz4_decompress.c
@@ -141,6 +141,9 @@ static FORCE_INLINE int LZ4_decompress_generic(
* space in the output for those 18 bytes earlier, upon
* entering the shortcut (in other words, there is a
* combined check for both stages).
+ *
+ * The & in the likely() below is intentionally not && so that
+ * some compilers can produce better parallelized runtime code
*/
if ((endOnInput ? length != RUN_MASK : length <= 8)
/*

\
 
 \ /
  Last update: 2020-06-08 03:03    [W:0.074 / U:0.084 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site