Log the freshness of the Variations seed in a histogram.
[chromium-blink-merge.git] / base / hash.h
blobcf8ea3a26e49475a9187d7005cc17b0f470609f6
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef BASE_HASH_H_
6 #define BASE_HASH_H_
8 #include <string>
10 #include "base/base_export.h"
11 #include "base/basictypes.h"
13 namespace base {
15 // From http://www.azillionmonkeys.com/qed/hash.html
16 // This is the hash used on WebCore/platform/stringhash
17 BASE_EXPORT uint32 SuperFastHash(const char * data, int len);
19 inline uint32 Hash(const char* key, size_t length) {
20 return SuperFastHash(key, static_cast<int>(length));
23 inline uint32 Hash(const std::string& key) {
24 if (key.empty())
25 return 0;
26 return SuperFastHash(key.data(), static_cast<int>(key.size()));
29 } // namespace base
31 #endif // BASE_HASH_H_