Function
writeVlq
(pos: number, num: number)
Source from the content-addressed store, hash-verified
| 22 | const scratch = /* #__PURE__ */ new Uint8Array(BUFFER_SIZE) |
| 23 | |
| 24 | function writeVlq(pos: number, num: number): number { |
| 25 | num = num < 0 ? (-num << 1) | 1 : num << 1 |
| 26 | do { |
| 27 | let clamped = num & 0b011111 |
| 28 | num >>>= 5 |
| 29 | if (num > 0) |
| 30 | clamped |= 0b100000 |
| 31 | scratch[pos++] = intToChar[clamped] |
| 32 | } while (num > 0) |
| 33 | return pos |
| 34 | } |
| 35 | |
| 36 | const decoder = /* #__PURE__ */ new TextDecoder() |
| 37 | |
Tested by
no test coverage detected