MCPcopy Index your code
hub / github.com/nodejs/node / wasmUnsignedLeb

Function wasmUnsignedLeb

deps/v8/test/mjsunit/wasm/wasm-module-builder.js:2441–2455  ·  view source on GitHub ↗
(val, max_len = 5)

Source from the content-addressed store, hash-verified

2439}
2440
2441function wasmUnsignedLeb(val, max_len = 5) {
2442 if (val == null) throw new Error("Leb value many not be null/undefined");
2443 let res = [];
2444 for (let i = 0; i < max_len; ++i) {
2445 let v = val & 0x7f;
2446 if (v == val) {
2447 res.push(v);
2448 return res;
2449 }
2450 res.push(v | 0x80);
2451 val = val >>> 7;
2452 }
2453 throw new Error(
2454 'Leb value <' + val + '> exceeds maximum length of ' + max_len);
2455}
2456
2457function wasmI32Const(val) {
2458 return [kExprI32Const, ...wasmSignedLeb(val, 5)];

Callers 15

generateBuildIdSectionFunction · 0.85
BuildAccessorsFunction · 0.85
toBufferMethod · 0.85
wasmBrOnCastImplFunction · 0.85
large-struct.jsFile · 0.85
BuildAccessorsFunction · 0.85
BuildAccessorsFunction · 0.85
StringToArrayFunction · 0.85
buildMethod · 0.85

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected