add preliminary support for nibbles

This commit is contained in:
Holly Stubbs 2021-10-21 01:27:45 +01:00
parent c039392b96
commit fff42cf947
Signed by: tgpholly
GPG Key ID: B8583C4B7D18119E
1 changed files with 5 additions and 0 deletions

View File

@ -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);