| 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 | /// |
no test coverage detected