31 static const char hexdigits[] =
"0123456789abcdef";
33 *--writer = hexdigits[value & 0xF];
38 if (end - writer < hex.
width) {
39 beg = end - hex.
width;
40 std::fill_n(beg, writer - beg, hex.
fill);
51 char*
const minfill = end - dec.
width;
56 *--writer =
'0' + (value % 10);
59 *--writer =
'0' +
value;
60 if (neg) *--writer =
'-';
62 ptrdiff_t fillers = writer - minfill;
66 bool add_sign_again =
false;
67 if (neg && dec.
fill ==
'0') {
69 add_sign_again =
true;
72 std::fill_n(writer, fillers, dec.
fill);
73 if (add_sign_again) *--writer =
'-';
91 char* after = out + x.
size();
102 char*
const begin = &*result.begin();
106 assert(out == begin + result.size());
114 char*
const begin = &*result.begin();
119 assert(out == begin + result.size());
128 char*
const begin = &*result.begin();
134 assert(out == begin + result.size());
138 namespace strings_internal {
141 std::string
CatPieces(std::initializer_list<absl::string_view> pieces) {
143 size_t total_size = 0;
147 char*
const begin = &*result.begin();
150 const size_t this_size = piece.size();
151 if (this_size != 0) {
152 memcpy(out, piece.data(), this_size);
156 assert(out == begin + result.size());
165 #define ASSERT_NO_OVERLAP(dest, src) \ 166 assert(((src).size() == 0) || \ 167 (uintptr_t((src).data() - (dest).data()) > uintptr_t((dest).size()))) 170 std::initializer_list<absl::string_view> pieces) {
171 size_t old_size = dest->size();
172 size_t total_size = old_size;
175 total_size += piece.size();
179 char*
const begin = &*dest->begin();
180 char*
out = begin + old_size;
182 const size_t this_size = piece.size();
183 if (this_size != 0) {
184 memcpy(out, piece.data(), this_size);
188 assert(out == begin + dest->size());
201 std::string::size_type old_size = dest->size();
203 dest, old_size + a.
size() + b.
size());
204 char*
const begin = &*dest->begin();
205 char*
out = begin + old_size;
208 assert(out == begin + dest->size());
216 std::string::size_type old_size = dest->size();
219 char*
const begin = &*dest->begin();
220 char*
out = begin + old_size;
224 assert(out == begin + dest->size());
233 std::string::size_type old_size = dest->size();
236 char*
const begin = &*dest->begin();
237 char*
out = begin + old_size;
242 assert(out == begin + dest->size());
absl::string_view::size_type size() const
void StrAppend(std::string *dest, const AlphaNum &a)
const char * data() const
std::string StrCat(const AlphaNum &a, const AlphaNum &b)
std::string CatPieces(std::initializer_list< absl::string_view > pieces)
void STLStringResizeUninitialized(string_type *s, size_t new_size)
#define ASSERT_NO_OVERLAP(dest, src)
char digits_[numbers_internal::kFastToBufferSize]
static char * Append(char *out, const AlphaNum &x)
static const int kFastToBufferSize
void AppendPieces(std::string *dest, std::initializer_list< absl::string_view > pieces)