MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / writeHeaderEntry

Function writeHeaderEntry

rusense_flasher/js/nvs_gen.js:41–51  ·  view source on GitHub ↗
(ns, type, span, key, data8)

Source from the content-addressed store, hash-verified

39 buf[byteIdx] &= (~(1 << bitOff)) & 0xFF;
40 };
41 const writeHeaderEntry = (ns, type, span, key, data8) => {
42 const o = off(slot);
43 buf[o] = ns; buf[o + 1] = type; buf[o + 2] = span; buf[o + 3] = 0xFF; // chunk = 0xFF
44 for (let i = 0; i < 16; i++) buf[o + 8 + i] = i < key.length ? key.charCodeAt(i) : 0x00;
45 for (let i = 0; i < 8; i++) buf[o + 24 + i] = data8[i];
46 const cd = new Uint8Array(28);
47 cd.set(buf.subarray(o, o + 4), 0);
48 cd.set(buf.subarray(o + 8, o + 32), 4);
49 dv.setUint32(o + 4, zlibCrc32(cd, CRC_SEED), true);
50 markWritten(slot); slot++;
51 };
52 const writePrimitive = (ns, type, key, valBytesLE) => {
53 const d8 = new Uint8Array(8).fill(0xFF);
54 d8.set(valBytesLE, 0);

Callers 2

writePrimitiveFunction · 0.85
writeStringFunction · 0.85

Calls 4

offFunction · 0.85
zlibCrc32Function · 0.85
markWrittenFunction · 0.85
setMethod · 0.80

Tested by

no test coverage detected