mirror of
https://github.com/protomaps/PMTiles.git
synced 2026-02-04 19:01:08 +00:00
fix offsets greater than 32 bits; don't use js bitwise operators
This commit is contained in:
@@ -7,12 +7,17 @@
|
|||||||
root.pmtiles = factory()
|
root.pmtiles = factory()
|
||||||
}
|
}
|
||||||
}(typeof self !== 'undefined' ? self : this, function () {
|
}(typeof self !== 'undefined' ? self : this, function () {
|
||||||
|
const shift = (number, shift) => {
|
||||||
|
return number * Math.pow(2, shift)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const getUint24 = (dataview, pos) => {
|
const getUint24 = (dataview, pos) => {
|
||||||
return (dataview.getUint16(pos+1,true) << 8) + dataview.getUint8(pos,true)
|
return shift(dataview.getUint16(pos+1,true),8) + dataview.getUint8(pos,true)
|
||||||
}
|
}
|
||||||
|
|
||||||
const getUint48 = (dataview, pos) => {
|
const getUint48 = (dataview, pos) => {
|
||||||
return (dataview.getUint32(pos+2,true) << 16) + dataview.getUint16(pos,true)
|
return shift(dataview.getUint32(pos+2,true),16) + dataview.getUint16(pos,true)
|
||||||
}
|
}
|
||||||
|
|
||||||
const parseHeader = dataview => {
|
const parseHeader = dataview => {
|
||||||
|
|||||||
Reference in New Issue
Block a user