(
byte: number,
)
| 214 | } |
| 215 | |
| 216 | #decode( |
| 217 | byte: number, |
| 218 | ): Promise<CborStreamOutput | [CborStreamOutput, lock: Promise<unknown>]> { |
| 219 | const majorType = byte >> 5; |
| 220 | const aI = byte & 0b000_11111; |
| 221 | switch (majorType) { |
| 222 | case 0: |
| 223 | return this.#decodeZero(aI); |
| 224 | case 1: |
| 225 | return this.#decodeOne(aI); |
| 226 | case 2: |
| 227 | return this.#decodeTwo(aI); |
| 228 | case 3: |
| 229 | return this.#decodeThree(aI); |
| 230 | case 4: |
| 231 | return this.#decodeFour(aI); |
| 232 | case 5: |
| 233 | return this.#decodeFive(aI); |
| 234 | case 6: |
| 235 | return this.#decodeSix(aI); |
| 236 | default: |
| 237 | return this.#decodeSeven(aI); |
| 238 | } |
| 239 | } |
| 240 | |
| 241 | async #decodeZero(aI: number): Promise<number | bigint> { |
| 242 | if (aI < 24) return aI; |
no test coverage detected