(isNegative, integer, chunk)
| 370 | } |
| 371 | |
| 372 | #continueDecodeDoubleInteger(isNegative, integer, chunk) { |
| 373 | let cursor = this.#cursor; |
| 374 | do { |
| 375 | const byte = chunk[cursor]; |
| 376 | switch (byte) { |
| 377 | case ASCII['.']: |
| 378 | this.#cursor = cursor + 1; // skip . |
| 379 | return this.#cursor < chunk.length ? |
| 380 | this.#decodeDoubleDecimal(isNegative, 0, integer, chunk) : |
| 381 | this.#decodeDoubleDecimal.bind(this, isNegative, 0, integer); |
| 382 | |
| 383 | case ASCII.E: |
| 384 | case ASCII.e: { |
| 385 | this.#cursor = cursor + 1; // skip E/e |
| 386 | const i = isNegative ? -integer : integer; |
| 387 | return this.#cursor < chunk.length ? |
| 388 | this.#decodeDoubleExponent(i, chunk) : |
| 389 | this.#decodeDoubleExponent.bind(this, i); |
| 390 | } |
| 391 | |
| 392 | case ASCII['\r']: |
| 393 | this.#cursor = cursor + 2; // skip \r\n |
| 394 | return isNegative ? -integer : integer; |
| 395 | |
| 396 | default: |
| 397 | integer = integer * 10 + byte - ASCII['0']; |
| 398 | } |
| 399 | } while (++cursor < chunk.length); |
| 400 | |
| 401 | this.#cursor = cursor; |
| 402 | return this.#continueDecodeDoubleInteger.bind(this, isNegative, integer); |
| 403 | } |
| 404 | |
| 405 | // Precalculated multipliers for decimal points to improve performance |
| 406 | // "... about 15 to 17 decimal places ..." |
no test coverage detected