mmdb-lib 2.2.0 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/decoder.js +5 -8
- package/package.json +1 -1
package/lib/decoder.js
CHANGED
|
@@ -226,7 +226,7 @@ class Decoder {
|
|
|
226
226
|
return this.db.readUIntBE(offset, size);
|
|
227
227
|
}
|
|
228
228
|
if (size == 8) {
|
|
229
|
-
return this.db.
|
|
229
|
+
return this.db.readBigUInt64BE(offset).toString();
|
|
230
230
|
}
|
|
231
231
|
if (size > 16) {
|
|
232
232
|
return 0;
|
|
@@ -237,13 +237,10 @@ class Decoder {
|
|
|
237
237
|
return this.db.toString('utf8', offset, offset + size);
|
|
238
238
|
}
|
|
239
239
|
decodeBigUint(offset, size) {
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
for (let i = 0; i < numberOfLongs; i++) {
|
|
245
|
-
integer =
|
|
246
|
-
integer * BigInt(4294967296) + BigInt(buffer.readUInt32BE(i << 2));
|
|
240
|
+
let integer = 0n;
|
|
241
|
+
for (let i = 0; i < size; i++) {
|
|
242
|
+
integer <<= 8n;
|
|
243
|
+
integer |= BigInt(this.db.readUInt8(offset + i));
|
|
247
244
|
}
|
|
248
245
|
return integer.toString();
|
|
249
246
|
}
|