Closed
Description
Currently using the following small work around in order to port a script that uses DataView
, but would be very nice with native support:
class DataView {
source: Uint8Array
buffer: ArrayBuffer
byteOffset: u32
byteLength: u32
constructor (source: Uint8Array) {
this.source = source
this.buffer = source.buffer
this.byteOffset = source.byteOffset
this.byteLength = source.byteLength
}
getUint32 (byteOffset: u32, littleEndian: boolean): u32 {
return (this.source[byteOffset] << 24) & (this.source[byteOffset + 1] << 16) & (this.source[byteOffset + 2] << 8) & (this.source[byteOffset + 3])
}
getUint16 (byteOffset: u32, littleEndian: boolean): u32 {
return (this.source[byteOffset] << 8) & (this.source[byteOffset + 1])
}
}
If someone could point me in the right direction I would be happy to try and implement this
Metadata
Metadata
Assignees
Labels
No labels