diff options
Diffstat (limited to 'src/utils.ts')
| -rw-r--r-- | src/utils.ts | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/utils.ts b/src/utils.ts index f47f584..e4024f0 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -92,4 +92,11 @@ export function writeString(str: string, buffer: Uint8Array, index: number) { } export function encodeString(str: string) { return encoder.encode(str); +} + +export function readBoolean(buffer: Uint8Array, index: number) { + return buffer[index] !== 0; +} +export function writeBoolean(bool: boolean, buffer: Uint8Array, index: number) { + buffer[index] = bool ? 1 : 0; }
\ No newline at end of file |
