OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2012, 2013 Apple Inc. All rights reserved | 2 * Copyright (C) 2006, 2007, 2008, 2012, 2013 Apple Inc. All rights reserved |
3 * Copyright (C) Research In Motion Limited 2009. All rights reserved. | 3 * Copyright (C) Research In Motion Limited 2009. All rights reserved. |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 return equal(a.impl(), b.impl()); | 60 return equal(a.impl(), b.impl()); |
61 } | 61 } |
62 | 62 |
63 static const bool safeToCompareToEmptyOrDeleted = false; | 63 static const bool safeToCompareToEmptyOrDeleted = false; |
64 }; | 64 }; |
65 | 65 |
66 class CaseFoldingHash { | 66 class CaseFoldingHash { |
67 public: | 67 public: |
68 static unsigned hash(const UChar* data, unsigned length) | 68 static unsigned hash(const UChar* data, unsigned length) |
69 { | 69 { |
70 return StringHasher::computeHashAndMaskTop8Bits<UChar, foldCase<UCha
r> >(data, length); | 70 return StringHasher::computeHashAndMaskTop8Bits<UChar, foldCase<UCha
r>>(data, length); |
71 } | 71 } |
72 | 72 |
73 static unsigned hash(StringImpl* str) | 73 static unsigned hash(StringImpl* str) |
74 { | 74 { |
75 if (str->is8Bit()) | 75 if (str->is8Bit()) |
76 return hash(str->characters8(), str->length()); | 76 return hash(str->characters8(), str->length()); |
77 return hash(str->characters16(), str->length()); | 77 return hash(str->characters16(), str->length()); |
78 } | 78 } |
79 | 79 |
80 static unsigned hash(const LChar* data, unsigned length) | 80 static unsigned hash(const LChar* data, unsigned length) |
81 { | 81 { |
82 return StringHasher::computeHashAndMaskTop8Bits<LChar, foldCase<LCha
r> >(data, length); | 82 return StringHasher::computeHashAndMaskTop8Bits<LChar, foldCase<LCha
r>>(data, length); |
83 } | 83 } |
84 | 84 |
85 static inline unsigned hash(const char* data, unsigned length) | 85 static inline unsigned hash(const char* data, unsigned length) |
86 { | 86 { |
87 return CaseFoldingHash::hash(reinterpret_cast<const LChar*>(data), l
ength); | 87 return CaseFoldingHash::hash(reinterpret_cast<const LChar*>(data), l
ength); |
88 } | 88 } |
89 | 89 |
90 static inline bool equal(const StringImpl* a, const StringImpl* b) | 90 static inline bool equal(const StringImpl* a, const StringImpl* b) |
91 { | 91 { |
92 return equalIgnoringCaseNonNull(a, b); | 92 return equalIgnoringCaseNonNull(a, b); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 } | 154 } |
155 }; | 155 }; |
156 | 156 |
157 } | 157 } |
158 | 158 |
159 using WTF::AlreadyHashed; | 159 using WTF::AlreadyHashed; |
160 using WTF::CaseFoldingHash; | 160 using WTF::CaseFoldingHash; |
161 using WTF::StringHash; | 161 using WTF::StringHash; |
162 | 162 |
163 #endif | 163 #endif |
OLD | NEW |