MCPcopy Create free account
hub / github.com/apache/tvm / loadSmallBytes

Method loadSmallBytes

web/src/memory.ts:212–222  ·  view source on GitHub ↗

* Load small bytes from value pointer. * @param ffiAnyPtr

(ffiAnyPtr: Pointer)

Source from the content-addressed store, hash-verified

210 * @param ffiAnyPtr
211 */
212 loadSmallBytes(ffiAnyPtr: Pointer): Uint8Array {
213 if (this.buffer != this.memory.buffer) {
214 this.updateViews();
215 }
216 const sizePtr = ffiAnyPtr + SizeOf.I32;
217 const length = this.loadU32(sizePtr);
218 const dataPtr = ffiAnyPtr + SizeOf.I32 + SizeOf.I32;
219 const result = new Uint8Array(length);
220 result.set(this.viewU8.slice(dataPtr, dataPtr + length));
221 return result;
222 }
223 /**
224 * Load bytearray as string from ptr.
225 * @param byteArrayPtr The head address of the bytearray.

Callers 1

retValueToJSMethod · 0.80

Calls 3

updateViewsMethod · 0.95
loadU32Method · 0.95
sliceMethod · 0.45

Tested by

no test coverage detected