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

Function PadAlignment

tensorflow/core/util/tensor_bundle/tensor_bundle.cc:386–397  ·  view source on GitHub ↗

Writes zeros to output buffer to align the next write to the requested alignment. "size" is the current size of the buffer and is updated to the new size.

Source from the content-addressed store, hash-verified

384// alignment. "size" is the current size of the buffer and is updated to the
385// new size.
386Status PadAlignment(FileOutputBuffer* out, int alignment, int64* size) {
387 int bytes_over = *size % alignment;
388 if (bytes_over == 0) {
389 return Status::OK();
390 }
391 int bytes_to_write = alignment - bytes_over;
392 Status status = out->Append(string(bytes_to_write, '\0'));
393 if (status.ok()) {
394 *size += bytes_to_write;
395 }
396 return status;
397}
398
399} // namespace
400

Callers 1

AddMethod · 0.70

Calls 2

AppendMethod · 0.45
okMethod · 0.45

Tested by

no test coverage detected