(bytes: number)
| 57 | } |
| 58 | |
| 59 | function nextPow2(bytes: number): number { |
| 60 | if (!Number.isFinite(bytes) || bytes <= 0) return 1; |
| 61 | const n = Math.ceil(bytes); |
| 62 | return 2 ** Math.ceil(Math.log2(n)); |
| 63 | } |
| 64 | |
| 65 | function computeGrownCapacityBytes(currentCapacityBytes: number, requiredBytes: number): number { |
| 66 | // Grow geometrically to reduce buffer churn (power-of-two policy). |
no outgoing calls
no test coverage detected