MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / getHeapOffset

Function getHeapOffset

src/parseTools.mjs:409–422  ·  view source on GitHub ↗
(offset, type)

Source from the content-addressed store, hash-verified

407}
408
409function getHeapOffset(offset, type) {
410 const sz = getNativeTypeSize(type);
411 if (sz == 1) {
412 return offset;
413 }
414 if (MEMORY64 == 1) {
415 return `((${offset})/${sz})`;
416 }
417 const shifts = Math.log(sz) / Math.LN2;
418 if (CAN_ADDRESS_2GB) {
419 return `((${offset})>>>${shifts})`;
420 }
421 return `((${offset})>>${shifts})`;
422}
423
424function ensureDot(value) {
425 value = value.toString();

Callers 3

makeGetValueFunction · 0.85
makeSetValueImplFunction · 0.85
makeHEAPViewFunction · 0.85

Calls 2

getNativeTypeSizeFunction · 0.85
logMethod · 0.80

Tested by

no test coverage detected