feat(README, filledDataView, sizedDataView)

This commit is contained in:
2025-08-08 12:32:55 +03:00
parent c5c0c17db2
commit c3e0e286a8
17 changed files with 322 additions and 30 deletions

View File

@ -1,19 +1,3 @@
export function filledDataView(bytes) {
const ab = new ArrayBuffer(bytes.length)
const dv = new DataView(ab)
for (let i = 0; i < bytes.length; i++) {
dv.setInt8(i, bytes[i])
}
return dv
}
export function sizedDataView(length) {
const ab = new ArrayBuffer(length)
return new DataView(ab)
}
export function expectDataViewEqual(actual, expected) {
const actualBytes = new Uint8Array(actual.buffer, actual.byteOffset, actual.byteLength)
const expectedBytes = new Uint8Array(expected.buffer, expected.byteOffset, expected.byteLength)