MCPcopy Create free account
hub / github.com/NVlabs/nvbio / alloc

Method alloc

nvbio/basic/vector_array.h:122–135  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

120 ///
121 NVBIO_FORCEINLINE NVBIO_HOST_DEVICE
122 T* alloc(const uint32 index, const uint32 size)
123 {
124 const uint32 slot = atomic_add( m_pool, size );
125 if (slot + size >= m_size)
126 {
127 // mark an out-of-bounds allocation
128 m_index[index] = m_size;
129 m_sizes[index] = 0u;
130 return NULL;
131 }
132 m_index[index] = slot;
133 m_sizes[index] = size;
134 return m_arena + slot;
135 }
136
137 /// return the vector corresponding to the given index
138 ///

Callers 3

operator()Method · 0.45
operator()Method · 0.45
operator()Method · 0.45

Calls 1

atomic_addFunction · 0.85

Tested by

no test coverage detected