Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@jsprismarine/jsbinaryutils

Package Overview
Dependencies
Maintainers
2
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jsprismarine/jsbinaryutils - npm Package Compare versions

Comparing version
3.2.1
to
3.2.2
+9
-14
dist/BinaryStream.js

@@ -505,8 +505,4 @@ "use strict";

readVarLong() {
// TODO: for some reasons works with this weird hack,
// anyway it is better to properly fix it in the next patch
const raw = this.readUnsignedVarLong();
return raw / 2n;
// const tmp = (((raw << 63n) >> 63n) ^ raw) >> 1n;
// return tmp ^ (raw & (1n << 63n));
return raw >> 1n;
}

@@ -524,3 +520,3 @@ /**

readUnsignedVarLong() {
let value = 0;
let value = 0n;
for (let i = 0; i <= 63; i += 7) {

@@ -530,6 +526,6 @@ if (this.feof()) {

}
let b = this.readByte();
value |= (b & 0x7f) << i;
const b = this.readByte();
value |= (BigInt(b) & 0x7fn) << BigInt(i);
if ((b & 0x80) === 0) {
return BigInt(value);
return value;
}

@@ -545,12 +541,11 @@ }

writeUnsignedVarLong(v) {
let val = Number(v);
for (let i = 0; i < 10; ++i) {
if (val >> 7 !== 0) {
this.writeByte(val | 0x80);
if (v >> 7n !== 0n) {
this.writeByte(Number(v | 0x80n));
}
else {
this.writeByte(val & 0x7f);
this.writeByte(Number(v & 0x7fn));
break;
}
val >>>= 7;
v >>= 7n;
}

@@ -557,0 +552,0 @@ }

{
"name": "@jsprismarine/jsbinaryutils",
"version": "3.2.1",
"version": "3.2.2",
"description": "Basic binary data managing tool written in TypeScript.",

@@ -5,0 +5,0 @@ "main": "./dist/BinaryStream.js",