MCPcopy Create free account
hub / github.com/alliedmodders/sourcemod / AddUInt

Function AddUInt

core/logic/sprintf.cpp:438–480  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

436}
437
438void AddUInt(char **buf_p, size_t &maxlen, uint64_t val, int width, int flags)
439{
440 char text[32];
441 int digits;
442 char *buf;
443
444 digits = 0;
445 do
446 {
447 text[digits++] = '0' + val % 10;
448 val /= 10;
449 } while (val);
450
451 buf = *buf_p;
452
453 if (!(flags & LADJUST))
454 {
455 while (digits < width && maxlen)
456 {
457 *buf++ = (flags & ZEROPAD) ? '0' : ' ';
458 width--;
459 maxlen--;
460 }
461 }
462
463 while (digits-- && maxlen)
464 {
465 *buf++ = text[digits];
466 width--;
467 maxlen--;
468 }
469
470 if (flags & LADJUST)
471 {
472 while ((width-- > 0) && maxlen)
473 {
474 *buf++ = (flags & ZEROPAD) ? '0' : ' ';
475 maxlen--;
476 }
477 }
478
479 *buf_p = buf;
480}
481
482void AddInt(char **buf_p, size_t &maxlen, int64_t val, int width, int flags)
483{

Callers 2

gnprintfFunction · 0.85
atcprintfFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected