(size: number)
| 1425 | |
| 1426 | // Reserves `size` zeroed bytes of the output in `slab`, and returns their offset |
| 1427 | private reserve(size: number): number { |
| 1428 | if (this.offset + size > this.slab.length) { |
| 1429 | this.cut() |
| 1430 | this.slab = new Uint8Array(Math.max(SLAB_SIZE, size)) |
| 1431 | this.start = 0 |
| 1432 | this.offset = 0 |
| 1433 | } |
| 1434 | const offset = this.offset |
| 1435 | this.offset += size |
| 1436 | this.buffered += size |
| 1437 | return offset |
| 1438 | } |
| 1439 | } |