| 100 | return nullptr; |
| 101 | } |
| 102 | __forceinline void free ( char * ptr ) { |
| 103 | ptrdiff_t idx = (ptr - data) / size; |
| 104 | DAS_ASSERT ( idx>=0 && idx<ptrdiff_t(total) ); |
| 105 | uint64_t uidx = uint64_t(idx); |
| 106 | uint64_t i = uidx >> 5; |
| 107 | uint32_t j = uint32_t(uidx & 31); |
| 108 | uint32_t b = bits[i]; |
| 109 | DAS_ASSERT((b & (1u<<j))!=0 && "calling free on the pointer, which is already free"); |
| 110 | bits[i] = b ^ (1u<<j); |
| 111 | look = i; |
| 112 | allocated --; |
| 113 | } |
| 114 | __forceinline bool mark ( char * ptr ) { |
| 115 | ptrdiff_t idx = (ptr - data) / size; |
| 116 | DAS_ASSERT ( idx>=0 && idx<ptrdiff_t(total) ); |