MCPcopy Create free account
hub / github.com/apache/arrow / operator()

Method operator()

cpp/src/arrow/io/memory_test.cc:444–453  ·  view source on GitHub ↗

A transform that duplicates every byte

Source from the content-addressed store, hash-verified

442struct DoublingTransform {
443 // A transform that duplicates every byte
444 Result<std::shared_ptr<Buffer>> operator()(const std::shared_ptr<Buffer>& buf) {
445 ARROW_ASSIGN_OR_RAISE(auto dest, AllocateBuffer(buf->size() * 2));
446 const uint8_t* data = buf->data();
447 uint8_t* out_data = dest->mutable_data();
448 for (int64_t i = 0; i < buf->size(); ++i) {
449 out_data[i * 2] = data[i];
450 out_data[i * 2 + 1] = data[i];
451 }
452 return std::shared_ptr<Buffer>(std::move(dest));
453 }
454};
455
456struct SwappingTransform {

Callers

nothing calls this directly

Calls 3

dataMethod · 0.45
mutable_dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected