1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-25 09:38:06 +02:00

Introduce a readInt16 helper function in the src/core/core_utils.js file

Rather than manually repeating code needed to get an int16, we can move and re-use an existing helper function instead.
This commit is contained in:
Jonas Jenwald 2025-01-28 17:13:42 +01:00
parent b0b9552216
commit 237a17ad56
3 changed files with 17 additions and 14 deletions

View file

@ -227,6 +227,10 @@ function readInt8(data, offset) {
return (data[offset] << 24) >> 24;
}
function readInt16(data, offset) {
return ((data[offset] << 24) | (data[offset + 1] << 16)) >> 16;
}
function readUint16(data, offset) {
return (data[offset] << 8) | data[offset + 1];
}
@ -733,6 +737,7 @@ export {
ParserEOFException,
parseXFAPath,
PDF_VERSION_REGEXP,
readInt16,
readInt8,
readUint16,
readUint32,