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

Function fxTypedArraySetPropertyValue

xs/sources/xsDataView.c:1404–1429  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1402}
1403
1404txBoolean fxTypedArraySetPropertyValue(txMachine* the, txSlot* instance, txID id, txIndex index, txSlot* value, txSlot* receiver)
1405{
1406 if ((!id) || fxIsCanonicalIndex(the, id)) {
1407 txSlot* dispatch = instance->next;
1408 txSlot* view = dispatch->next;
1409 txSlot* buffer = view->next;
1410 txU2 shift = dispatch->value.typedArray.dispatch->shift;
1411 txSlot* arrayBuffer = buffer->value.reference->next;
1412 txIndex length;
1413 if (arrayBuffer->flag & XS_DONT_SET_FLAG)
1414 return 0;
1415 if ((receiver->kind == XS_REFERENCE_KIND) && (receiver->value.reference == instance)) {
1416 dispatch->value.typedArray.dispatch->coerce(the, value);
1417 length = fxGetDataViewSize(the, view, buffer) >> shift;
1418 if ((!id) && (index < length)) {
1419 (*dispatch->value.typedArray.dispatch->setter)(the, buffer->value.reference->next, view->value.dataView.offset + (index << shift), value, EndianNative);
1420 }
1421 return 1;
1422 }
1423 length = fxGetDataViewSize(the, view, buffer) >> shift;
1424 if ((id) || (index >= length)) {
1425 return 1;
1426 }
1427 }
1428 return fxOrdinarySetPropertyValue(the, instance, id, index, value, receiver);
1429}
1430
1431void fxCallTypedArrayItem(txMachine* the, txSlot* function, txSlot* dispatch, txSlot* view, txSlot* data, txInteger index, txSlot* item)
1432{

Callers 1

fxTypedArraySetterFunction · 0.85

Calls 3

fxIsCanonicalIndexFunction · 0.85
fxGetDataViewSizeFunction · 0.85

Tested by

no test coverage detected