* Allocate then set the argument location with a TVMByteArray. * Allocate new temporary space for bytes. * * @param offset The offset to set ot data pointer. * @param data The string content.
(offset: PtrOffset, data: Uint8Array)
| 476 | * @param data The string content. |
| 477 | */ |
| 478 | allocThenSetArgBytes(offset: PtrOffset, data: Uint8Array): void { |
| 479 | // Note: size of size_t equals sizeof ptr. |
| 480 | const headerOffset = this.allocRawBytes(this.memory.sizeofPtr() * 2); |
| 481 | const dataOffset = this.allocRawBytes(data.length); |
| 482 | this.storeRawBytes(dataOffset, data); |
| 483 | this.storeUSize(headerOffset + this.memory.sizeofPtr(), data.length); |
| 484 | |
| 485 | this.addressToSetTargetValue.push([offset, headerOffset]); |
| 486 | this.addressToSetTargetValue.push([headerOffset, dataOffset]); |
| 487 | } |
| 488 | |
| 489 | /** |
| 490 | * Update internal cache views. |
no test coverage detected