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

Function sdsull2str

app/redis-6.2.6/src/sds.c:517–543  ·  view source on GitHub ↗

Identical sdsll2str(), but for unsigned long long type. */

Source from the content-addressed store, hash-verified

515
516/* Identical sdsll2str(), but for unsigned long long type. */
517int sdsull2str(char *s, unsigned long long v) {
518 char *p, aux;
519 size_t l;
520
521 /* Generate the string representation, this method produces
522 * a reversed string. */
523 p = s;
524 do {
525 *p++ = '0'+(v%10);
526 v /= 10;
527 } while(v);
528
529 /* Compute length and add null term. */
530 l = p-s;
531 *p = '\0';
532
533 /* Reverse the string. */
534 p--;
535 while(s < p) {
536 aux = *s;
537 *s = *p;
538 *p = aux;
539 s++;
540 p--;
541 }
542 return l;
543}
544
545/* Create an sds string from a long long value. It is much faster than:
546 *

Callers 1

sdscatfmtFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected