mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 17:30:09 +02:00
rename getUint32 to getInt32 and collect readInt*() in util.js
This commit is contained in:
parent
b33f4adf88
commit
b06c10cbbd
6 changed files with 50 additions and 72 deletions
|
@ -423,6 +423,28 @@ function string32(value) {
|
|||
(value >> 8) & 0xff, value & 0xff);
|
||||
}
|
||||
|
||||
function log2(x) {
|
||||
var n = 1, i = 0;
|
||||
while (x > n) {
|
||||
n <<= 1;
|
||||
i++;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
function readInt8(data, start) {
|
||||
return (data[start] << 24) >> 24;
|
||||
}
|
||||
|
||||
function readUint16(data, offset) {
|
||||
return (data[offset] << 8) | data[offset + 1];
|
||||
}
|
||||
|
||||
function readUint32(data, offset) {
|
||||
return ((data[offset] << 24) | (data[offset + 1] << 16) |
|
||||
(data[offset + 2] << 8) | data[offset + 3]) >>> 0;
|
||||
}
|
||||
|
||||
// Lazy test the endianness of the platform
|
||||
// NOTE: This will be 'true' for simulated TypedArrays
|
||||
function isLittleEndian() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue