summaryrefslogtreecommitdiffstats
path: root/searchlib
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@online.no>2022-06-22 21:09:06 +0200
committerTor Egge <Tor.Egge@online.no>2022-06-22 21:09:06 +0200
commitaa7b705991ffb236edac79f329229c3598a433ae (patch)
treeb90db945c1569b2677b0f916d9401d4b5aeaf6f1 /searchlib
parent1242ec5b569d86c90045151fc2def817fce6e530 (diff)
Avoid undefined shift.
Diffstat (limited to 'searchlib')
-rw-r--r--searchlib/src/vespa/searchlib/bitcompression/compression.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/searchlib/src/vespa/searchlib/bitcompression/compression.h b/searchlib/src/vespa/searchlib/bitcompression/compression.h
index 441fac3aef1..74231638213 100644
--- a/searchlib/src/vespa/searchlib/bitcompression/compression.h
+++ b/searchlib/src/vespa/searchlib/bitcompression/compression.h
@@ -504,7 +504,11 @@ public:
if (length >= cacheFree) { \
cacheInt |= (data << (64 - cacheFree)); \
*bufI++ = EC::bswap(cacheInt); \
- data >>= cacheFree; \
+ if (__builtin_expect(cacheFree != 64, true)) { \
+ data >>= cacheFree; \
+ } else { \
+ data = 0; \
+ } \
length -= cacheFree; \
cacheInt = 0; \
cacheFree = 64; \