* @param {ArrayBuffer} buf An ArrayBuffer. * @returns {bigint}
(buf)
| 558 | * @returns {bigint} |
| 559 | */ |
| 560 | function arrayBufferToUnsignedBigInt(buf) { |
| 561 | const length = ArrayBufferPrototypeGetByteLength(buf); |
| 562 | const chars = Array(length * 2); |
| 563 | const view = new DataView(buf); |
| 564 | |
| 565 | for (let i = 0; i < length; i++) { |
| 566 | const val = DataViewPrototypeGetUint8(view, i); |
| 567 | chars[2 * i] = numberToHexCharCode(val >> 4); |
| 568 | chars[2 * i + 1] = numberToHexCharCode(val & 0xf); |
| 569 | } |
| 570 | |
| 571 | return BigInt(`0x${StringFromCharCodeApply(chars)}`); |
| 572 | } |
| 573 | |
| 574 | function unsignedBigIntToBuffer(bigint, name) { |
| 575 | if (bigint < 0) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…