MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / AppendPieces

Function AppendPieces

tensorflow/core/lib/strings/strcat.cc:144–161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

142 DCHECK_GE(uintptr_t((src).data() - (dest).data()), uintptr_t((dest).size()))
143
144void AppendPieces(string *result, std::initializer_list<StringPiece> pieces) {
145 size_t old_size = result->size();
146 size_t total_size = old_size;
147 for (const StringPiece piece : pieces) {
148 DCHECK_NO_OVERLAP(*result, piece);
149 total_size += piece.size();
150 }
151 gtl::STLStringResizeUninitialized(result, total_size);
152
153 char *const begin = &*result->begin();
154 char *out = begin + old_size;
155 for (const StringPiece piece : pieces) {
156 const size_t this_size = piece.size();
157 memcpy(out, piece.data(), this_size);
158 out += this_size;
159 }
160 DCHECK_EQ(out, begin + result->size());
161}
162
163} // namespace internal
164

Callers 1

StrAppendFunction · 0.85

Calls 4

sizeMethod · 0.45
beginMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected