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

Function fxSetArrayBufferData

xs/sources/xsDataView.c:139–150  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

137}
138
139void fxSetArrayBufferData(txMachine* the, txSlot* slot, txInteger byteOffset, void* data, txInteger byteLength)
140{
141 txSlot* instance = fxCheckArrayBufferInstance(the, slot);
142 txSlot* arrayBuffer = instance->next;
143 txSlot* bufferInfo = arrayBuffer->next;
144 txInteger length = bufferInfo->value.bufferInfo.length;
145 if ((byteOffset < 0) || (length < byteOffset))
146 mxRangeError("invalid byteOffset %ld", byteOffset);
147 if ((byteLength < 0) || (length < (byteOffset + byteLength)))
148 mxRangeError("invalid byteLength %ld", byteLength);
149 c_memcpy(arrayBuffer->value.arrayBuffer.address + byteOffset, data, byteLength);
150}
151
152void fxSetArrayBufferLength(txMachine* the, txSlot* slot, txInteger target)
153{

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected