| ... | ... | @@ -34,39 +34,39 @@ pub const Allocator = struct { |
| 34 | 34 | /// The returned slice must have its pointer aligned at least to `new_alignment` bytes. |
| 35 | 35 | reallocFn: fn ( |
| 36 | 36 | self: *Allocator, |
| 37 | | // Guaranteed to be the same as what was returned from most recent call to |
| 38 | | // `reallocFn` or `shrinkFn`. |
| 39 | | // If `old_mem.len == 0` then this is a new allocation and `new_byte_count` |
| 40 | | // is guaranteed to be >= 1. |
| 37 | /// Guaranteed to be the same as what was returned from most recent call to |
| 38 | /// `reallocFn` or `shrinkFn`. |
| 39 | /// If `old_mem.len == 0` then this is a new allocation and `new_byte_count` |
| 40 | /// is guaranteed to be >= 1. |
| 41 | 41 | old_mem: []u8, |
| 42 | | // If `old_mem.len == 0` then this is `undefined`, otherwise: |
| 43 | | // Guaranteed to be the same as what was returned from most recent call to |
| 44 | | // `reallocFn` or `shrinkFn`. |
| 45 | | // Guaranteed to be >= 1. |
| 46 | | // Guaranteed to be a power of 2. |
| 42 | /// If `old_mem.len == 0` then this is `undefined`, otherwise: |
| 43 | /// Guaranteed to be the same as what was returned from most recent call to |
| 44 | /// `reallocFn` or `shrinkFn`. |
| 45 | /// Guaranteed to be >= 1. |
| 46 | /// Guaranteed to be a power of 2. |
| 47 | 47 | old_alignment: u29, |
| 48 | | // If `new_byte_count` is 0 then this is a free and it is guaranteed that |
| 49 | | // `old_mem.len != 0`. |
| 48 | /// If `new_byte_count` is 0 then this is a free and it is guaranteed that |
| 49 | /// `old_mem.len != 0`. |
| 50 | 50 | new_byte_count: usize, |
| 51 | | // Guaranteed to be >= 1. |
| 52 | | // Guaranteed to be a power of 2. |
| 53 | | // Returned slice's pointer must have this alignment. |
| 51 | /// Guaranteed to be >= 1. |
| 52 | /// Guaranteed to be a power of 2. |
| 53 | /// Returned slice's pointer must have this alignment. |
| 54 | 54 | new_alignment: u29, |
| 55 | 55 | ) Error![]u8, |
| 56 | 56 | |
| 57 | 57 | /// This function deallocates memory. It must succeed. |
| 58 | 58 | shrinkFn: fn ( |
| 59 | 59 | self: *Allocator, |
| 60 | | // Guaranteed to be the same as what was returned from most recent call to |
| 61 | | // `reallocFn` or `shrinkFn`. |
| 60 | /// Guaranteed to be the same as what was returned from most recent call to |
| 61 | /// `reallocFn` or `shrinkFn`. |
| 62 | 62 | old_mem: []u8, |
| 63 | | // Guaranteed to be the same as what was returned from most recent call to |
| 64 | | // `reallocFn` or `shrinkFn`. |
| 63 | /// Guaranteed to be the same as what was returned from most recent call to |
| 64 | /// `reallocFn` or `shrinkFn`. |
| 65 | 65 | old_alignment: u29, |
| 66 | | // Guaranteed to be less than or equal to `old_mem.len`. |
| 66 | /// Guaranteed to be less than or equal to `old_mem.len`. |
| 67 | 67 | new_byte_count: usize, |
| 68 | | // If `new_byte_count == 0` then this is `undefined`, otherwise: |
| 69 | | // Guaranteed to be less than or equal to `old_alignment`. |
| 68 | /// If `new_byte_count == 0` then this is `undefined`, otherwise: |
| 69 | /// Guaranteed to be less than or equal to `old_alignment`. |
| 70 | 70 | new_alignment: u29, |
| 71 | 71 | ) []u8, |
| 72 | 72 | |