MCPcopy Index your code
hub / github.com/ChartGPU/ChartGPU / nextPow2

Function nextPow2

src/data/createDataStore.ts:59–63  ·  view source on GitHub ↗
(bytes: number)

Source from the content-addressed store, hash-verified

57}
58
59function 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
65function computeGrownCapacityBytes(currentCapacityBytes: number, requiredBytes: number): number {
66 // Grow geometrically to reduce buffer churn (power-of-two policy).

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected