Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
| 5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
| 6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
| 7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
| 8 * | 8 * |
| 9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 217 }; | 217 }; |
| 218 | 218 |
| 219 template<bool canCompareWithMemcmp, typename T> | 219 template<bool canCompareWithMemcmp, typename T> |
| 220 struct VectorComparer; | 220 struct VectorComparer; |
| 221 | 221 |
| 222 template<typename T> | 222 template<typename T> |
| 223 struct VectorComparer<false, T> | 223 struct VectorComparer<false, T> |
| 224 { | 224 { |
| 225 static bool compare(const T* a, const T* b, size_t size) | 225 static bool compare(const T* a, const T* b, size_t size) |
| 226 { | 226 { |
| 227 if (!a || !b) { | |
|
tkent
2014/06/16 04:42:26
I recommend to write popular case at first. e.g.
yoichio
2014/06/16 04:58:45
Done.
| |
| 228 if (!a && !b) | |
| 229 return true; | |
| 230 return false; | |
| 231 } | |
| 227 return std::equal(a, a + size, b); | 232 return std::equal(a, a + size, b); |
| 228 } | 233 } |
| 229 }; | 234 }; |
| 230 | 235 |
| 231 template<typename T> | 236 template<typename T> |
| 232 struct VectorComparer<true, T> | 237 struct VectorComparer<true, T> |
| 233 { | 238 { |
| 234 static bool compare(const T* a, const T* b, size_t size) | 239 static bool compare(const T* a, const T* b, size_t size) |
| 235 { | 240 { |
| 236 return memcmp(a, b, sizeof(T) * size) == 0; | 241 return memcmp(a, b, sizeof(T) * size) == 0; |
| (...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1194 } | 1199 } |
| 1195 if (this->hasOutOfLineBuffer()) | 1200 if (this->hasOutOfLineBuffer()) |
| 1196 Allocator::markNoTracing(visitor, buffer()); | 1201 Allocator::markNoTracing(visitor, buffer()); |
| 1197 } | 1202 } |
| 1198 | 1203 |
| 1199 } // namespace WTF | 1204 } // namespace WTF |
| 1200 | 1205 |
| 1201 using WTF::Vector; | 1206 using WTF::Vector; |
| 1202 | 1207 |
| 1203 #endif // WTF_Vector_h | 1208 #endif // WTF_Vector_h |
| OLD | NEW |