Function: readWideInt()
ts
function readWideInt<V>(cursor, size): V;Defined in: cursor/readWideInt.ts:23
Reads a signed integer field of 4 or 8 bytes. The field is 64 bits in one version of its box.
With no int64 function on the cursor, the function returns a number. A field of 8 bytes then loses precision outside the safe integer range. With the function, the result is the result of the int64 function.
Type Parameters
V
V extends IsoInt64 = number
Parameters
cursor
The cursor to read from. The function moves the cursor past the field.
size
4 | 8
The size of the field in bytes.
Returns
V
The value of the field.
Throws
RangeError if the field passes cursor.end.
Example
ts
// A tfdt reader that follows the int64 option of the configuration.
const readTfdtWide = <V extends IsoInt64>(cursor: IsoBoxReadCursor<V>) => {
const version = readUint8(cursor)
const flags = readUint24(cursor)
const baseMediaDecodeTime = readWideUint(cursor, version === 1 ? 8 : 4)
return { type: 'tfdt' as const, version, flags, baseMediaDecodeTime }
}