diff options
author | Ran Benita <ran@unusedvar.com> | 2019-11-09 13:47:16 +0200 |
---|---|---|
committer | Ran Benita <ran@unusedvar.com> | 2019-11-09 13:50:59 +0200 |
commit | adbd9c6f0819a3ddd5a06237238e9becdb036e17 (patch) | |
tree | 3267012d7da7a57b09fc72948f29975a2967f396 | |
parent | 9ebf97d70636f751182e4bc99e8e6a483698747c (diff) | |
download | libxkbcommon-adbd9c6f0819a3ddd5a06237238e9becdb036e17.tar.gz libxkbcommon-adbd9c6f0819a3ddd5a06237238e9becdb036e17.tar.bz2 libxkbcommon-adbd9c6f0819a3ddd5a06237238e9becdb036e17.zip |
atom: correct iteration count in hash function
Fixup of ccab349 - unlike the commit message, hash a byte twice instead
of zero times, which is probably better. This is how it was before.
Signed-off-by: Ran Benita <ran@unusedvar.com>
-rw-r--r-- | src/atom.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -78,7 +78,7 @@ static inline uint32_t hash_buf(const char *string, size_t len) { uint32_t hash = 2166136261u; - for (size_t i = 0; i < len / 2; i++) { + for (size_t i = 0; i < (len + 1) / 2; i++) { hash ^= (uint8_t) string[i]; hash *= 0x01000193; hash ^= (uint8_t) string[len - 1 - i]; |