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

View File

@@ -1,6 +1,5 @@
abstract class Serializable<T> {
static boolFlag = 0x80;
private static depth = 0;
private static maxDisplayedJsonLength = 160;
private static enableDump = true;
@@ -46,15 +45,6 @@ abstract class Serializable<T> {
return value;
}
/* should have assert uint8? */
binToBool(bin: number) {
return (bin & Serializable.boolFlag) !== 0;
}
boolToBin(bool: boolean) {
return bool ? Serializable.boolFlag : 0;
}
abstract _fromJsObject(jsObject: any): Serializable<T>;
abstract _fromBinary(buffer: UhkBuffer): Serializable<T>;
abstract _toJsObject(): any;