MCPcopy Index your code
hub / github.com/AztecProtocol/huff / processMemory

Function processMemory

src/runtime.js:30–45  ·  view source on GitHub ↗
(bnArray)

Source from the content-addressed store, hash-verified

28}
29
30function processMemory(bnArray) {
31 let calldatalength = 0;
32 for (const { index, len } of bnArray) {
33 if (index + len > calldatalength) {
34 calldatalength = index + len;
35 }
36 }
37 const buffer = new Array(calldatalength).fill(0);
38 for (const { index, value, len } of bnArray) {
39 const hex = toBytesN(value.toString(16), len);
40 for (let i = 0; i < hex.length; i += 2) {
41 buffer[i / 2 + index] = parseInt(`${hex[i]}${hex[i + 1]}`, 16);
42 }
43 }
44 return buffer;
45}
46
47function getPushOp(hex) {
48 const data = utils.formatEvenBytes(hex);

Callers 1

runCodeFunction · 0.85

Calls 1

toBytesNFunction · 0.85

Tested by

no test coverage detected