| 78 | |
| 79 | |
| 80 | __hot |
| 81 | bool slice_ostream::writeDecimal(uint64_t n) noexcept { |
| 82 | // Optimized for speed; this is on a hot path in LiteCore |
| 83 | if (n < 10) { |
| 84 | return writeByte('0' + (char)n); |
| 85 | } else { |
| 86 | char temp[20]; // max length is 20 decimal digits |
| 87 | char *dst = &temp[20]; |
| 88 | size_t len = 0; |
| 89 | do { |
| 90 | *(--dst) = '0' + (n % 10); |
| 91 | n /= 10; |
| 92 | len++; |
| 93 | } while (n > 0); |
| 94 | return write(dst, len); |
| 95 | } |
| 96 | } |
| 97 | |
| 98 | |
| 99 | bool slice_ostream::writeHex(uint64_t n) noexcept { |
nothing calls this directly
no outgoing calls
no test coverage detected