Spaces:
Configuration error
Configuration error
Download node_modules/capnp-ts/src/serialization/pointers/bool-list.ts from W404NET/Telegram-Chat-Bot: direct link, hf CLI and curl.
- Browser
- Download file 1.03 kB
-
https://huggingface.co/spaces/W404NET/Telegram-Chat-Bot/resolve/main/node_modules/capnp-ts/src/serialization/pointers/bool-list.ts
- Command line
-
hf download hf://spaces/W404NET/Telegram-Chat-Bot/node_modules/capnp-ts/src/serialization/pointers/bool-list.ts
-
curl -L -o bool-list.ts https://huggingface.co/spaces/W404NET/Telegram-Chat-Bot/resolve/main/node_modules/capnp-ts/src/serialization/pointers/bool-list.ts
1.03 kB
| /** | |
| * @author jdiaz5513 | |
| */ | |
| import initTrace from "debug"; | |
| import { ListElementSize } from "../list-element-size"; | |
| import { _ListCtor, List } from "./list"; | |
| import { getContent } from "./pointer"; | |
| const trace = initTrace("capnp:list:composite"); | |
| trace("load"); | |
| export class BoolList extends List<boolean> { | |
| static readonly _capnp: _ListCtor = { | |
| displayName: "List<boolean>" as string, | |
| size: ListElementSize.BIT | |
| }; | |
| get(index: number): boolean { | |
| const bitMask = 1 << index % 8; | |
| const byteOffset = index >>> 3; | |
| const c = getContent(this); | |
| const v = c.segment.getUint8(c.byteOffset + byteOffset); | |
| return (v & bitMask) !== 0; | |
| } | |
| set(index: number, value: boolean): void { | |
| const bitMask = 1 << index % 8; | |
| const c = getContent(this); | |
| const byteOffset = c.byteOffset + (index >>> 3); | |
| const v = c.segment.getUint8(byteOffset); | |
| c.segment.setUint8(byteOffset, value ? v | bitMask : v & ~bitMask); | |
| } | |
| toString(): string { | |
| return `Bool_${super.toString()}`; | |
| } | |
| } | |