summaryrefslogtreecommitdiff
path: root/absl/hash/internal/low_level_hash.cc
diff options
context:
space:
mode:
authorGravatar Abseil Team <absl-team@google.com>2022-08-01 08:29:37 -0700
committerGravatar Copybara-Service <copybara-worker@google.com>2022-08-01 08:30:25 -0700
commit16af2bbcb9dd1770c64483aed8cd7d4ae7061064 (patch)
tree358b0bc9ba9786d4af2f49546d2b06868e80e568 /absl/hash/internal/low_level_hash.cc
parentdc370a82467cb35066475537b797197aee3e5164 (diff)
Fix "unsafe narrowing" warnings in absl, 2/n.
Addresses failures with the following, in some files: -Wshorten-64-to-32 -Wimplicit-int-conversion -Wsign-compare -Wsign-conversion -Wtautological-unsigned-zero-compare (This specific CL focuses on .cc files in dirs a-h.) Bug: chromium:1292951 PiperOrigin-RevId: 464541951 Change-Id: If23b63ccea8e9b730159ff1c7288e9300a40b6bd
Diffstat (limited to 'absl/hash/internal/low_level_hash.cc')
-rw-r--r--absl/hash/internal/low_level_hash.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/absl/hash/internal/low_level_hash.cc b/absl/hash/internal/low_level_hash.cc
index d288f3ec..e05e7885 100644
--- a/absl/hash/internal/low_level_hash.cc
+++ b/absl/hash/internal/low_level_hash.cc
@@ -106,7 +106,8 @@ uint64_t LowLevelHash(const void* data, size_t len, uint64_t seed,
} else if (len > 0) {
// If we have at least 1 and at most 3 bytes, read all of the provided
// bits into A, with some adjustments.
- a = ((ptr[0] << 16) | (ptr[len >> 1] << 8) | ptr[len - 1]);
+ a = static_cast<uint64_t>((ptr[0] << 16) | (ptr[len >> 1] << 8) |
+ ptr[len - 1]);
b = 0;
} else {
a = 0;