| 39 | void addFreeSlot(ChunkedArray* arr, u8* ptr); |
| 40 | |
| 41 | void serialize(ChunkedArray* arr, FileStream* file) |
| 42 | { |
| 43 | assert(file); |
| 44 | size_t size = size_t(&arr->chunks) - sizeof(arr); |
| 45 | file->writeBuffer(arr, (u32)size); |
| 46 | |
| 47 | const u32 chunkAllocSize = arr->elemPerChunk * arr->elemSize; |
| 48 | for (u32 i = 0; i < arr->chunkCount; i++) |
| 49 | { |
| 50 | file->write(arr->chunks[i], chunkAllocSize); |
| 51 | } |
| 52 | |
| 53 | for (u32 i = 0; i < arr->freeSlotCount; i++) |
| 54 | { |
| 55 | s32 freeSlotIndex = getSlotIndex(arr, arr->freeSlots[i]); |
| 56 | file->write(&freeSlotIndex); |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | ChunkedArray* restore(FileStream* file, MemoryRegion* region) |
| 61 | { |
no test coverage detected