MCPcopy Create free account
hub / github.com/buke/quickjs-go / getTypedArrayInfo

Method getTypedArrayInfo

value.go:844–850  ·  view source on GitHub ↗

getTypedArrayInfo is a helper function to extract TypedArray information using C API

()

Source from the content-addressed store, hash-verified

842
843// getTypedArrayInfo is a helper function to extract TypedArray information using C API
844func (v *Value) getTypedArrayInfo() (buffer *Value, byteOffset, byteLength, bytesPerElement int) {
845 var cByteOffset, cByteLength, cBytesPerElement C.size_t
846 bufferRef := C.JS_GetTypedArrayBuffer(v.ctx.ref, v.ref, &cByteOffset, &cByteLength, &cBytesPerElement)
847
848 return &Value{ctx: v.ctx, ref: bufferRef},
849 int(cByteOffset), int(cByteLength), int(cBytesPerElement)
850}
851
852// ToInt8Array converts the value to int8 slice if it's an Int8Array.
853func (v *Value) ToInt8Array() ([]int8, error) {

Callers 9

ToInt8ArrayMethod · 0.95
ToInt16ArrayMethod · 0.95
ToUint16ArrayMethod · 0.95
ToInt32ArrayMethod · 0.95
ToUint32ArrayMethod · 0.95
ToFloat32ArrayMethod · 0.95
ToFloat64ArrayMethod · 0.95
ToBigInt64ArrayMethod · 0.95
ToBigUint64ArrayMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected