| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2005, 2006, 2008, 2010, 2013 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006, 2008, 2010, 2013 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com> | 3 * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com> |
| 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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 { | 184 { |
| 185 // FIXME: Why does this function use the version of the hash that drops
the top 8 bits? | 185 // FIXME: Why does this function use the version of the hash that drops
the top 8 bits? |
| 186 // We want that for all string hashing so we can use those bits in Strin
gImpl and hash | 186 // We want that for all string hashing so we can use those bits in Strin
gImpl and hash |
| 187 // strings consistently, but I don't see why we'd want that for general
memory hashing. | 187 // strings consistently, but I don't see why we'd want that for general
memory hashing. |
| 188 ASSERT(!(length % 2)); | 188 ASSERT(!(length % 2)); |
| 189 return computeHashAndMaskTop8Bits<UChar>(static_cast<const UChar*>(data)
, length / sizeof(UChar)); | 189 return computeHashAndMaskTop8Bits<UChar>(static_cast<const UChar*>(data)
, length / sizeof(UChar)); |
| 190 } | 190 } |
| 191 | 191 |
| 192 template<size_t length> static unsigned hashMemory(const void* data) | 192 template<size_t length> static unsigned hashMemory(const void* data) |
| 193 { | 193 { |
| 194 COMPILE_ASSERT(!(length % 2), length_must_be_a_multiple_of_two); | 194 static_assert(!(length % 2), "length must be a multiple of two"); |
| 195 return hashMemory(data, length); | 195 return hashMemory(data, length); |
| 196 } | 196 } |
| 197 | 197 |
| 198 private: | 198 private: |
| 199 static UChar defaultConverter(UChar character) | 199 static UChar defaultConverter(UChar character) |
| 200 { | 200 { |
| 201 return character; | 201 return character; |
| 202 } | 202 } |
| 203 | 203 |
| 204 static UChar defaultConverter(LChar character) | 204 static UChar defaultConverter(LChar character) |
| (...skipping 25 matching lines...) Expand all Loading... |
| 230 unsigned m_hash; | 230 unsigned m_hash; |
| 231 bool m_hasPendingCharacter; | 231 bool m_hasPendingCharacter; |
| 232 UChar m_pendingCharacter; | 232 UChar m_pendingCharacter; |
| 233 }; | 233 }; |
| 234 | 234 |
| 235 } // namespace WTF | 235 } // namespace WTF |
| 236 | 236 |
| 237 using WTF::StringHasher; | 237 using WTF::StringHasher; |
| 238 | 238 |
| 239 #endif // WTF_StringHasher_h | 239 #endif // WTF_StringHasher_h |
| OLD | NEW |