MCPcopy Create free account
hub / github.com/couchbase/fleece / writeDecimal

Method writeDecimal

Fleece/Support/slice_stream.cc:80–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected