MCPcopy Create free account
hub / github.com/nodejs/node / ensure_space

Method ensure_space

test/fixtures/wpt/wasm/jsapi/wasm-module-builder.js:672–679  ·  view source on GitHub ↗
(needed)

Source from the content-addressed store, hash-verified

670 }
671
672 ensure_space(needed) {
673 if (this.buffer.length - this.length >= needed) return;
674 let new_capacity = this.buffer.length * 2;
675 while (new_capacity - this.length < needed) new_capacity *= 2;
676 let new_buffer = new Uint8Array(new_capacity);
677 new_buffer.set(this.buffer);
678 this.buffer = new_buffer;
679 }
680
681 trunc_buffer() {
682 return new Uint8Array(this.buffer.buffer, 0, this.length);

Callers 5

emit_u8Method · 0.95
emit_u16Method · 0.95
emit_u32Method · 0.95
emit_leb_uMethod · 0.95
emit_bytesMethod · 0.95

Calls 1

setMethod · 0.45

Tested by

no test coverage detected