| author | |
| committer | |
| log | 583ca36e62fc13b38348f9c42bbfb9ddd9fceaa0 |
| tree | 7add58c241ba443082caafda836c2d21d3779abc |
| parent | c03a76414717274d02280fdaaaceff1ef4151d07 |
1 files changed, 4 insertions(+), 0 deletions(-)
std/mem.zig+4| ... | ... | @@ -94,6 +94,10 @@ pub const IncrementingAllocator = struct { |
| 94 | 94 | _ = os.posix.munmap(self.bytes.ptr, self.bytes.len); |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | fn reset(self: &IncrementingAllocator) { | |
| 98 | self.end_index = 0; | |
| 99 | } | |
| 100 | ||
| 97 | 101 | fn alloc(allocator: &Allocator, n: usize, alignment: usize) -> %[]u8 { |
| 98 | 102 | const self = @fieldParentPtr(IncrementingAllocator, "allocator", allocator); |
| 99 | 103 | const addr = @ptrToInt(&self.bytes[self.end_index]); |