Changeset 17200 in webkit for trunk/JavaScriptCore/wtf/Vector.h
- Timestamp:
- Oct 21, 2006, 6:55:53 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/wtf/Vector.h
r17127 r17200 83 83 static void initialize(T* begin, T* end) 84 84 { 85 memset(begin, 0, reinterpret_cast<char *>(end) - reinterpret_cast<char*>(begin));85 memset(begin, 0, reinterpret_cast<char*>(end) - reinterpret_cast<char*>(begin)); 86 86 } 87 87 }; … … 123 123 static void move(const T* src, const T* srcEnd, T* dst) 124 124 { 125 memcpy(dst, src, reinterpret_cast<const char *>(srcEnd) - reinterpret_cast<const char*>(src));125 memcpy(dst, src, reinterpret_cast<const char*>(srcEnd) - reinterpret_cast<const char*>(src)); 126 126 } 127 127 static void moveOverlapping(const T* src, const T* srcEnd, T* dst) 128 128 { 129 memmove(dst, src, reinterpret_cast<const char *>(srcEnd) - reinterpret_cast<const char*>(src));129 memmove(dst, src, reinterpret_cast<const char*>(srcEnd) - reinterpret_cast<const char*>(src)); 130 130 } 131 131 }; … … 152 152 static void uninitializedCopy(const T* src, const T* srcEnd, T* dst) 153 153 { 154 memcpy(dst, src, reinterpret_cast<const char *>(srcEnd) - reinterpret_cast<const char*>(src));154 memcpy(dst, src, reinterpret_cast<const char*>(srcEnd) - reinterpret_cast<const char*>(src)); 155 155 } 156 156 }; … … 256 256 const T* buffer() const { return m_buffer; } 257 257 size_t capacity() const { return m_capacity; } 258 259 void swap(VectorBuffer<T, 0>& other) 260 { 261 std::swap(m_capacity, other.m_capacity); 262 std::swap(m_buffer, other.m_buffer); 263 } 258 264 259 265 T* releaseBuffer() … … 318 324 } 319 325 326 void swap(VectorBuffer<T, inlineCapacity>&); 327 320 328 private: 321 329 static const size_t m_inlineBufferSize = inlineCapacity * sizeof(T); 322 330 T* inlineBuffer() { return reinterpret_cast<T*>(&m_inlineBuffer); } 323 331 332 // FIXME: Nothing guarantees this buffer is appropriately aligned to hold objects of type T. 324 333 char m_inlineBuffer[m_inlineBufferSize]; 325 334 }; … … 428 437 } 429 438 430 void fill(const T& val, size_t size);439 void fill(const T&, size_t); 431 440 void fill(const T& val) { fill(val, size()); } 432 441 433 442 T* releaseBuffer(); 443 444 void swap(Vector<T, inlineCapacity>& other) 445 { 446 std::swap(m_size, other.m_size); 447 m_impl.swap(other.m_impl); 448 } 434 449 435 450 private: … … 646 661 } 647 662 663 template<typename T, size_t inlineCapacity> 664 inline void swap(Vector<T, inlineCapacity>& a, Vector<T, inlineCapacity>& b) 665 { 666 a.swap(b); 667 } 668 648 669 } // namespace WTF 649 670
Note:
See TracChangeset
for help on using the changeset viewer.