| 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) ); |
| 117 | uint64_t uidx = uint64_t(idx); |
| 118 | uint64_t i = uidx >> 5; |
| 119 | uint32_t j = uint32_t(uidx & 31); |
| 120 | uint32_t b = gc_bits[i]; |
| 121 | if ( !(b & (1u<<j)) ) { |
| 122 | gc_bits[i] = b | (1u<<j); |
| 123 | gc_allocated ++; |
| 124 | return true; |
| 125 | } |
| 126 | return false; |
| 127 | } |
| 128 | char * data = nullptr; |
| 129 | uint32_t * bits = nullptr; // 32-bit bitset words; indices are 64-bit |
| 130 | uint32_t * gc_bits = nullptr; |