MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / fxReadCode

Function fxReadCode

xs/sources/xsSnapshot.c:1351–1390  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1349}
1350
1351void fxReadCode(txMachine* the, txSnapshot* snapshot, txByte* data, txSize size)
1352{
1353 txByte* p = data;
1354 txByte* q = p + size;
1355 txU1 code;
1356 txSize offset = 0;
1357 txID id;
1358 txSlot* slot;
1359 while (p < q) {
1360 code = *((txU1*)p);
1361 offset = (txSize)gxCodeSizes[code];
1362 if (0 < offset) {
1363 p += offset;
1364 }
1365 else {
1366 p++;
1367 if (0 == offset) {
1368 mxDecodeID(p, id);
1369 if (id < the->keyIndex) {
1370 slot = the->keyArray[id];
1371 slot->flag |= XS_DONT_DELETE_FLAG;
1372 }
1373 }
1374 else if (-1 == offset) {
1375 txU1 value = *((txU1*)p++);
1376 p += value;
1377 }
1378 else if (-2 == offset) {
1379 txU2 value;
1380 mxDecode2(p, value);
1381 p += value;
1382 }
1383 else if (-4 == offset) {
1384 txU4 value;
1385 mxDecode4(p, value);
1386 p += value;
1387 }
1388 }
1389 }
1390}
1391
1392void fxPatchKeys(txMachine* the)
1393{

Callers 1

fxReadSnapshotFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected