Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: base/hash.h

Issue 181643004: Moved SuperFastHash function from base/hash.cc to base/third_party. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move SuperFastHash declaration to hash.cc and remove #ifdef __cplusplus. Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef BASE_HASH_H_ 5 #ifndef BASE_HASH_H_
6 #define BASE_HASH_H_ 6 #define BASE_HASH_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/base_export.h" 10 #include "base/base_export.h"
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 12
13 namespace base { 13 namespace base {
14 14
15 // From http://www.azillionmonkeys.com/qed/hash.html 15 BASE_EXPORT uint32 SuperFastHash(const char* data, int len);
16 // This is the hash used on WebCore/platform/stringhash
17 BASE_EXPORT uint32 SuperFastHash(const char * data, int len);
18 16
19 inline uint32 Hash(const char* key, size_t length) { 17 inline uint32 Hash(const char* key, size_t length) {
20 return SuperFastHash(key, static_cast<int>(length)); 18 return SuperFastHash(key, static_cast<int>(length));
21 } 19 }
22 20
23 inline uint32 Hash(const std::string& key) { 21 inline uint32 Hash(const std::string& key) {
24 if (key.empty()) 22 if (key.empty())
25 return 0; 23 return 0;
26 return SuperFastHash(key.data(), static_cast<int>(key.size())); 24 return SuperFastHash(key.data(), static_cast<int>(key.size()));
27 } 25 }
28 26
29 } // namespace base 27 } // namespace base
30 28
31 #endif // BASE_HASH_H_ 29 #endif // BASE_HASH_H_
OLDNEW
« no previous file with comments | « base/base.gypi ('k') | base/hash.cc » ('j') | base/third_party/superfasthash/superfasthash.c » ('J')

Powered by Google App Engine
This is Rietveld 408576698