Lines Matching refs:dataView
5 export function validateOffset(dataView: DataView, offset: number, width: number): void {
6 if (dataView.byteLength <= offset + width || (offset & (toByteWidth(width) - 1)) !== 0) {
11 export function readInt(dataView: DataView, offset: number, width: number): number | bigint {
14 return dataView.getInt8(offset);
16 return dataView.getInt16(offset, true);
20 return dataView.getInt32(offset, true)
22 if (dataView.setBigInt64 === undefined) {
23 …return BigInt(dataView.getUint32(offset, true)) + (BigInt(dataView.getUint32(offset + 4, true)) <<…
25 return dataView.getBigInt64(offset, true)
30 export function readUInt(dataView: DataView, offset: number, width: number): number | bigint {
33 return dataView.getUint8(offset);
35 return dataView.getUint16(offset, true);
39 return dataView.getUint32(offset, true)
41 if (dataView.getBigUint64 === undefined) {
42 …return BigInt(dataView.getUint32(offset, true)) + (BigInt(dataView.getUint32(offset + 4, true)) <<…
44 return dataView.getBigUint64(offset, true)
49 export function readFloat(dataView: DataView, offset: number, width: number): number {
54 return dataView.getFloat32(offset, true);
56 return dataView.getFloat64(offset, true);
59 export function indirect(dataView: DataView, offset: number, width: number): number {
60 const step = readUInt(dataView, offset, width) as number;
64 export function keyIndex(key: string, dataView: DataView, offset: number, parentWidth: number, byte…
66 const keysVectorOffset = indirect(dataView, offset, parentWidth) - byteWidth * 3;
68 const indirectOffset = keysVectorOffset - Number(readUInt(dataView, keysVectorOffset, bitWidth));
69 const _byteWidth = Number(readUInt(dataView, keysVectorOffset + byteWidth, bitWidth));
74 const dif = diffKeys(input, mid, dataView, indirectOffset, _byteWidth);
85 export function diffKeys(input: Uint8Array, index: number, dataView: DataView, offset: number, widt…
87 const keyIndirectOffset = keyOffset - Number(readUInt(dataView, keyOffset, fromByteWidth(width)));
89 const dif = input[i] - dataView.getUint8(keyIndirectOffset + i); constant
94 return dataView.getUint8(keyIndirectOffset + input.length) === 0 ? 0 : -1;
97 export function keyForIndex(index: number, dataView: DataView, offset: number, parentWidth: number,…
98 const keysVectorOffset = indirect(dataView, offset, parentWidth) - byteWidth * 3;
100 const indirectOffset = keysVectorOffset - Number(readUInt(dataView, keysVectorOffset, bitWidth));
101 const _byteWidth = Number(readUInt(dataView, keysVectorOffset + byteWidth, bitWidth));
103 …const keyIndirectOffset = keyOffset - Number(readUInt(dataView, keyOffset, fromByteWidth(_byteWidt…
105 while (dataView.getUint8(keyIndirectOffset + length) !== 0) {
108 return fromUTF8Array(new Uint8Array(dataView.buffer, keyIndirectOffset, length));