aboutsummaryrefslogtreecommitdiff
path: root/src/leveldb/util/hash.cc
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@protonmail.com>2020-01-28 16:59:07 +0100
committerWladimir J. van der Laan <laanwj@protonmail.com>2020-01-28 16:59:07 +0100
commit20a6babfa9a66f5432ef19c6c433b4357560f853 (patch)
tree0834cbc4054d41dfb8de5ec90143b4415adbc41d /src/leveldb/util/hash.cc
parent2755b2b1092d0286022cf3cc3028e96f6bee2b34 (diff)
parent66480821b36c839ab7615cb9309850015bceadb0 (diff)
downloadbitcoin-20a6babfa9a66f5432ef19c6c433b4357560f853.tar.xz
Update to leveldb upstream using subtree merge
Diffstat (limited to 'src/leveldb/util/hash.cc')
-rw-r--r--src/leveldb/util/hash.cc15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/leveldb/util/hash.cc b/src/leveldb/util/hash.cc
index ed439ce7a2..dd47c110ee 100644
--- a/src/leveldb/util/hash.cc
+++ b/src/leveldb/util/hash.cc
@@ -2,15 +2,19 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. See the AUTHORS file for names of contributors.
+#include "util/hash.h"
+
#include <string.h>
+
#include "util/coding.h"
-#include "util/hash.h"
// The FALLTHROUGH_INTENDED macro can be used to annotate implicit fall-through
// between switch labels. The real definition should be provided externally.
// This one is a fallback version for unsupported compilers.
#ifndef FALLTHROUGH_INTENDED
-#define FALLTHROUGH_INTENDED do { } while (0)
+#define FALLTHROUGH_INTENDED \
+ do { \
+ } while (0)
#endif
namespace leveldb {
@@ -34,13 +38,13 @@ uint32_t Hash(const char* data, size_t n, uint32_t seed) {
// Pick up remaining bytes
switch (limit - data) {
case 3:
- h += static_cast<unsigned char>(data[2]) << 16;
+ h += static_cast<uint8_t>(data[2]) << 16;
FALLTHROUGH_INTENDED;
case 2:
- h += static_cast<unsigned char>(data[1]) << 8;
+ h += static_cast<uint8_t>(data[1]) << 8;
FALLTHROUGH_INTENDED;
case 1:
- h += static_cast<unsigned char>(data[0]);
+ h += static_cast<uint8_t>(data[0]);
h *= m;
h ^= (h >> r);
break;
@@ -48,5 +52,4 @@ uint32_t Hash(const char* data, size_t n, uint32_t seed) {
return h;
}
-
} // namespace leveldb