/** * This function is for internal use only. * Convert the array buffer result coming from an hybrid object to an int 8 array */ export function bufferToInt8Array(buffer: ArrayBuffer): Int8Array { // Still have to decide if want to go for a copy or wrap is good enough // Copy version //const copy = new Int8Array(new ArrayBuffer(buffer.byteLength)) //copy.set(new Int8Array(buffer)) //return copy // Wrap version return new Int8Array(buffer) } /** * This function is for internal use only. * Converts an int8array to an array buffer for use with the hybrid objects */ export function int8ArrayToBuffer(data: Int8Array): ArrayBuffer { return data.buffer instanceof ArrayBuffer ? data.buffer : new Int8Array(data).buffer }