MCPcopy Create free account
hub / github.com/W4G1/multithreading / allocArray

Method allocArray

src/lib/json_buffer.ts:577–586  ·  view source on GitHub ↗
(initialCap: number)

Source from the content-addressed store, hash-verified

575 }
576
577 private allocArray(initialCap: number): number {
578 const capacity = Math.max(4, initialCap);
579 const byteSize = 12 + capacity * 8;
580 const ptr = this.alloc(byteSize);
581 const idx = ptr >> 2;
582 this.u32[idx] = TYPE_ARRAY;
583 this.u32[idx + 1] = capacity;
584 this.u32[idx + 2] = 0;
585 return ptr;
586 }
587
588 private writeInitial(target: Pointer, data: any) {
589 if (Array.isArray(data)) {

Callers 2

initializeBufferMethod · 0.95
writeValueMethod · 0.95

Calls 1

allocMethod · 0.95

Tested by

no test coverage detected