MCPcopy Create free account
hub / github.com/F-Stack/f-stack / sdigits10

Function sdigits10

app/redis-6.2.6/src/util.c:297–306  ·  view source on GitHub ↗

Like digits10() but for signed values. */

Source from the content-addressed store, hash-verified

295
296/* Like digits10() but for signed values. */
297uint32_t sdigits10(int64_t v) {
298 if (v < 0) {
299 /* Abs value of LLONG_MIN requires special handling. */
300 uint64_t uv = (v != LLONG_MIN) ?
301 (uint64_t)-v : ((uint64_t) LLONG_MAX)+1;
302 return digits10(uv)+1; /* +1 for the minus. */
303 } else {
304 return digits10(v);
305 }
306}
307
308/* Convert a long long into a string. Returns the number of
309 * characters needed to represent the number.

Callers 2

hashTypeGetValueLengthFunction · 0.85
stringObjectLenFunction · 0.85

Calls 1

digits10Function · 0.85

Tested by

no test coverage detected