442 char presentation = arg.presentation;
454 uval = UT(-static_cast<UT>(
val_));
457 uval =
static_cast<UT
>(
val_);
471 uval =
static_cast<UT
>(
val_);
476 "sign specifications not allowed for unsigned values");
486 constexpr
size_t valBufSize = 69;
487 char valBuf[valBufSize];
488 char* valBufBegin =
nullptr;
489 char* valBufEnd =
nullptr;
492 switch (presentation) {
496 "base prefix not allowed with '",
501 !arg.thousandsSeparator,
502 "cannot use ',' with the '",
506 valBufBegin = valBuf + 3;
507 #if defined(__ANDROID__) 510 (valBuf + valBufSize) - valBufBegin,
512 static_cast<uintmax_t>(uval));
516 size_t((valBuf + valBufSize) - valBufBegin),
518 static_cast<uintmax_t>(uval));
522 assert(len < valBuf + valBufSize - valBufBegin);
523 valBufEnd = valBufBegin + len;
529 "base prefix not allowed with '",
532 valBufBegin = valBuf + 3;
536 if (arg.thousandsSeparator) {
543 "base prefix not allowed with '",
547 !arg.thousandsSeparator,
548 "thousands separator (',') not allowed with '",
551 valBufBegin = valBuf + 3;
552 *valBufBegin =
static_cast<char>(uval);
553 valBufEnd = valBufBegin + 1;
558 !arg.thousandsSeparator,
559 "thousands separator (',') not allowed with '",
562 valBufEnd = valBuf + valBufSize - 1;
565 if (arg.basePrefix) {
566 *--valBufBegin =
'0';
572 !arg.thousandsSeparator,
573 "thousands separator (',') not allowed with '",
576 valBufEnd = valBuf + valBufSize - 1;
579 if (arg.basePrefix) {
580 *--valBufBegin =
'x';
581 *--valBufBegin =
'0';
587 !arg.thousandsSeparator,
588 "thousands separator (',') not allowed with '",
591 valBufEnd = valBuf + valBufSize - 1;
594 if (arg.basePrefix) {
595 *--valBufBegin =
'X';
596 *--valBufBegin =
'0';
603 !arg.thousandsSeparator,
604 "thousands separator (',') not allowed with '",
607 valBufEnd = valBuf + valBufSize - 1;
610 if (arg.basePrefix) {
611 *--valBufBegin = presentation;
612 *--valBufBegin =
'0';
617 arg.error(
"invalid specifier '", presentation,
"'");
621 *--valBufBegin = sign;
626 StringPiece(valBufBegin, valBufEnd), prefixLen, arg, cb);
uint32_t uint64ToBufferUnsafe(uint64_t v, char *const buffer)
size_t uintToBinary(char *buffer, size_t bufLen, Uint v)
size_t uintToHexLower(char *buffer, size_t bufLen, Uint v)
size_t uintToOctal(char *buffer, size_t bufLen, Uint v)
static const char *const value
void insertThousandsGroupingUnsafe(char *start_buffer, char **end_buffer)
constexpr bool is_negative(T x)
size_t uintToHexUpper(char *buffer, size_t bufLen, Uint v)
Range< const char * > StringPiece