MCPcopy Create free account
hub / github.com/OpenFodder/openfodder / capacity

Method capacity

Source/Utils/micropather.h:115–126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

113
114 private:
115 void capacity( unsigned cap ) {
116 if ( m_allocated < cap ) {
117 unsigned newAllocated = cap * 3/2 + 16;
118 T* newBuf = new T[newAllocated];
119 MPASSERT( m_size <= m_allocated );
120 MPASSERT( m_size < newAllocated );
121 memcpy( newBuf, m_buf, sizeof(T)*m_size );
122 delete [] m_buf;
123 m_buf = newBuf;
124 m_allocated = newAllocated;
125 }
126 }
127 unsigned m_allocated;
128 unsigned m_size;
129 T* m_buf;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected