MCPcopy Index your code
hub / github.com/apache/tvm / loadByteArrayAsString

Method loadByteArrayAsString

web/src/memory.ts:227–239  ·  view source on GitHub ↗

* Load bytearray as string from ptr. * @param byteArrayPtr The head address of the bytearray.

(byteArrayPtr: Pointer)

Source from the content-addressed store, hash-verified

225 * @param byteArrayPtr The head address of the bytearray.
226 */
227 loadByteArrayAsString(byteArrayPtr: Pointer): string {
228 if (this.buffer != this.memory.buffer) {
229 this.updateViews();
230 }
231 const ptr = this.loadPointer(byteArrayPtr);
232 const length = this.loadUSize(byteArrayPtr + this.sizeofPtr());
233 // NOTE: the views are still valid for read.
234 const ret = [];
235 for (let i = 0; i < length; i++) {
236 ret.push(String.fromCharCode(this.viewU8[ptr + i]));
237 }
238 return ret.join("");
239 }
240 /**
241 * Load bytearray as bytes from ptr.
242 * @param byteArrayPtr The head address of the bytearray.

Callers 2

loadTypeInfoTypeKeyMethod · 0.95
retValueToJSMethod · 0.80

Calls 5

updateViewsMethod · 0.95
loadPointerMethod · 0.95
loadUSizeMethod · 0.95
sizeofPtrMethod · 0.95
joinMethod · 0.45

Tested by

no test coverage detected