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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 83 static void clear(T*, T*) { } | 83 static void clear(T*, T*) { } |
| 84 #if ENABLE(ASSERT) | 84 #if ENABLE(ASSERT) |
| 85 static void checkCleared(const T*, const T*) { } | 85 static void checkCleared(const T*, const T*) { } |
| 86 #endif | 86 #endif |
| 87 }; | 87 }; |
| 88 | 88 |
| 89 template<typename T> | 89 template<typename T> |
| 90 struct VectorUnusedSlotClearer<true, T> { | 90 struct VectorUnusedSlotClearer<true, T> { |
| 91 static void clear(T* begin, T* end) | 91 static void clear(T* begin, T* end) |
| 92 { | 92 { |
| 93 memset(begin, 0, sizeof(T) * (end - begin)); | 93 memset(reinterpret_cast<void*>(begin), 0, sizeof(T) * (end - begin)) ; |
|
tkent
2015/05/07 00:43:21
Why do you do reinterpret_cast<>?
haraken
2015/05/07 00:49:40
Because without the reinterpret_cast, clang compla
tkent
2015/05/08 06:42:00
Thanks. lgtm
| |
| 94 } | 94 } |
| 95 | 95 |
| 96 #if ENABLE(ASSERT) | 96 #if ENABLE(ASSERT) |
| 97 static void checkCleared(const T* begin, const T* end) | 97 static void checkCleared(const T* begin, const T* end) |
| 98 { | 98 { |
| 99 const unsigned char* unusedArea = reinterpret_cast<const unsigned ch ar*>(begin); | 99 const unsigned char* unusedArea = reinterpret_cast<const unsigned ch ar*>(begin); |
| 100 const unsigned char* endAddress = reinterpret_cast<const unsigned ch ar*>(end); | 100 const unsigned char* endAddress = reinterpret_cast<const unsigned ch ar*>(end); |
| 101 ASSERT(endAddress >= unusedArea); | 101 ASSERT(endAddress >= unusedArea); |
| 102 for (int i = 0; i < endAddress - unusedArea; ++i) | 102 for (int i = 0; i < endAddress - unusedArea; ++i) |
| 103 ASSERT(!unusedArea[i]); | 103 ASSERT(!unusedArea[i]); |
| (...skipping 1219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1323 struct NeedsTracing<Vector<T, N>> { | 1323 struct NeedsTracing<Vector<T, N>> { |
| 1324 static const bool value = false; | 1324 static const bool value = false; |
| 1325 }; | 1325 }; |
| 1326 #endif | 1326 #endif |
| 1327 | 1327 |
| 1328 } // namespace WTF | 1328 } // namespace WTF |
| 1329 | 1329 |
| 1330 using WTF::Vector; | 1330 using WTF::Vector; |
| 1331 | 1331 |
| 1332 #endif // WTF_Vector_h | 1332 #endif // WTF_Vector_h |
| OLD | NEW |