MCPcopy Create free account
hub / github.com/antirez/botlib / sdsull2str

Function sdsull2str

sds.c:482–508  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

480
481/* Identical sdsll2str(), but for unsigned long long type. */
482int sdsull2str(char *s, unsigned long long v) {
483 char *p, aux;
484 size_t l;
485
486 /* Generate the string representation, this method produces
487 * an reversed string. */
488 p = s;
489 do {
490 *p++ = '0'+(v%10);
491 v /= 10;
492 } while(v);
493
494 /* Compute length and add null term. */
495 l = p-s;
496 *p = '\0';
497
498 /* Reverse the string. */
499 p--;
500 while(s < p) {
501 aux = *s;
502 *s = *p;
503 *p = aux;
504 s++;
505 p--;
506 }
507 return l;
508}
509
510/* Create an sds string from a long long value. It is much faster than:
511 *

Callers 1

sdscatfmtFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected