()
| 81 | return this.#a.subarray(i, this.#i) |
| 82 | } |
| 83 | getInteger() { |
| 84 | if (this.getTag() !== 2) |
| 85 | throw new Error("BER: not an integer"); |
| 86 | const length = this.getLength(); |
| 87 | const offset = this.#a.byteOffset + this.#i; |
| 88 | if (this.peek() & 0x80) { |
| 89 | const c = this.getChunk(length).slice(); // copy. cannot modify source data. |
| 90 | for (let i = 0; i < length; i++) // could use Logical.not |
| 91 | c[i] = ~c[i]; |
| 92 | return -(BigInt.fromArrayBuffer(c.buffer) + 1n); |
| 93 | } |
| 94 | else { |
| 95 | this.skip(length) |
| 96 | return BigInt.fromArrayBuffer(this.#a.buffer.slice(offset, offset + length)); |
| 97 | } |
| 98 | } |
| 99 | getBitString() { |
| 100 | let result; |
| 101 | if (this.getTag() != 3) |
no test coverage detected