mirror of
https://github.com/DeveloperExotic/LegacyCrossPlay.git
synced 2026-07-16 05:21:09 +00:00
21 lines
551 B
JavaScript
21 lines
551 B
JavaScript
/* --------------------------------------------------------------- */
|
|
/* utils.js */
|
|
/* --------------------------------------------------------------- */
|
|
function encodeVarInt(value) {
|
|
const bytes = [];
|
|
do {
|
|
let temp = value & 0x7f;
|
|
value >>>= 7;
|
|
if (value !== 0) {
|
|
temp |= 0x80;
|
|
}
|
|
bytes.push(temp);
|
|
} while (value !== 0);
|
|
return Buffer.from(bytes);
|
|
}
|
|
|
|
module.exports = {
|
|
encodeVarInt,
|
|
};
|
|
/* --------------------------------------------------------------- */
|