move bin<->bool conversion to UhkBuffer

This commit is contained in:
Sam Rang
2016-04-18 20:00:27 -05:00
parent 0c53b49c6a
commit 634aa6c532
5 changed files with 16 additions and 18 deletions
+8
View File
@@ -143,6 +143,14 @@ class UhkBuffer {
this.offset += stringByteLength;
}
readBoolean(): boolean {
return this.readUInt8() !== 0;
}
writeBoolean(bool: boolean) {
this.writeUInt8(bool ? 1 : 0);
}
backtrack(): void {
this.offset -= this.bytesToBacktrack;
this.bytesToBacktrack = 0;