summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorYann Collet <cyan@fb.com>2018-09-19 01:08:59 (GMT)
committerYann Collet <cyan@fb.com>2018-09-19 19:12:49 (GMT)
commitb2215f2a8996e0cfd0d1950968c1ab43733be161 (patch)
tree5abbcfea7cc2ac9323bd2a4f302abcc3cd264fd0 /lib
parente75d04791fdb53056a1ae7892e9e41c89e34640e (diff)
downloadlz4-b2215f2a8996e0cfd0d1950968c1ab43733be161.zip
lz4-b2215f2a8996e0cfd0d1950968c1ab43733be161.tar.gz
lz4-b2215f2a8996e0cfd0d1950968c1ab43733be161.tar.bz2
tried to clean another bunch of cppcheck warnings
so "funny" thing with cppcheck is that no 2 versions give the same list of warnings. On Mac, I'm using v1.81, which had all warnings fixed. On Travis CI, it's v1.61, and it complains about a dozen more/different things. On Linux, it's v1.72, and it finds a completely different list of a half dozen warnings. Some of these seems to be bugs/limitations in cppcheck itself. The TravisCI version v1.61 seems unable to understand %zu correctly, and seems to assume it means %u.
Diffstat (limited to 'lib')
-rw-r--r--lib/lz4.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/lz4.c b/lib/lz4.c
index df7a2c7..3c7467a 100644
--- a/lib/lz4.c
+++ b/lib/lz4.c
@@ -522,13 +522,14 @@ static U32 LZ4_hash4(U32 sequence, tableType_t const tableType)
static U32 LZ4_hash5(U64 sequence, tableType_t const tableType)
{
- static const U64 prime5bytes = 889523592379ULL;
- static const U64 prime8bytes = 11400714785074694791ULL;
const U32 hashLog = (tableType == byU16) ? LZ4_HASHLOG+1 : LZ4_HASHLOG;
- if (LZ4_isLittleEndian())
+ if (LZ4_isLittleEndian()) {
+ const U64 prime5bytes = 889523592379ULL;
return (U32)(((sequence << 24) * prime5bytes) >> (64 - hashLog));
- else
+ } else {
+ const U64 prime8bytes = 11400714785074694791ULL;
return (U32)(((sequence >> 24) * prime8bytes) >> (64 - hashLog));
+ }
}
LZ4_FORCE_INLINE U32 LZ4_hashPosition(const void* const p, tableType_t const tableType)