Commit fb2e15db authored by Dave Tapuska's avatar Dave Tapuska Committed by Commit Bot

Avoid 64 bit truncation errors from the compiler for hash

While not possible the compiler still generates errors without
casts.

BUG=879657

Change-Id: I1975197135c8ab2bd0723360180d851b8be17e93
Reviewed-on: https://chromium-review.googlesource.com/c/1348954Reviewed-by: default avatarFrançois Doray <fdoray@chromium.org>
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Cr-Commit-Position: refs/heads/master@{#610615}
parent 79789655
...@@ -47,7 +47,8 @@ inline size_t HashInts(T1 value1, T2 value2) { ...@@ -47,7 +47,8 @@ inline size_t HashInts(T1 value1, T2 value2) {
if (sizeof(T1) > sizeof(uint32_t) || (sizeof(T2) > sizeof(uint32_t))) if (sizeof(T1) > sizeof(uint32_t) || (sizeof(T2) > sizeof(uint32_t)))
return HashInts64(value1, value2); return HashInts64(value1, value2);
return HashInts32(value1, value2); return HashInts32(static_cast<uint32_t>(value1),
static_cast<uint32_t>(value2));
} }
// A templated hasher for pairs of integer types. Example: // A templated hasher for pairs of integer types. Example:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment