Obtains a pointer to the memory region that holds the elements of the typed
array; modifications done to them will be visible to JavaScript code. If
length is not null, the number of elements contained in the typed array
are also stored in the pointed location.
The returned pointer needs to be casted to the appropriate type (see
#JSCTypedArrayType), and has the offset over the underlying array
buffer data applied—that is, points to the first element of the typed
array:
if (jsc_value_typed_array_get_type(value) != JSC_TYPED_ARRAY_UINT32)
g_error ("Only arrays of uint32_t are supported");
gsize count = 0;
uint32_t *elements = jsc_value_typed_array_get_contents (value, &count);
for (gsize i = 0; i < count; i++)
g_print ("index %zu, value %" PRIu32 "\n", i, elements[i]);
Note that the pointer returned by this function is not guaranteed to remain
the same after calls to other JSC API functions. See
javascriptcore.value.Value.arrayBufferGetData for details.
Obtains a pointer to the memory region that holds the elements of the typed array; modifications done to them will be visible to JavaScript code. If length is not null, the number of elements contained in the typed array are also stored in the pointed location.
The returned pointer needs to be casted to the appropriate type (see #JSCTypedArrayType), and has the offset over the underlying array buffer data applied—that is, points to the first element of the typed array:
Note that the pointer returned by this function is not guaranteed to remain the same after calls to other JSC API functions. See javascriptcore.value.Value.arrayBufferGetData for details.