From fff42cf947083bdae6624b809c3c563496af15d0 Mon Sep 17 00:00:00 2001 From: Holly Date: Thu, 21 Oct 2021 01:27:45 +0100 Subject: [PATCH] add preliminary support for nibbles --- server/bufferStuff.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/server/bufferStuff.js b/server/bufferStuff.js index b351835..de2ea9e 100644 --- a/server/bufferStuff.js +++ b/server/bufferStuff.js @@ -30,6 +30,11 @@ module.exports.Writer = class { this.writeByte(data ? 1 : 0); } + // NOTE: Currently writing a nibble requires you to write both halves at the same time. + writeNibble(nibble1 = 0, nibble2 = 0) { + this.writeUByte(nibble1 | (nibble2 << 4)); + } + writeByte(data = 0) { if (this.baseSize == 0) { const buff = Buffer.alloc(1);