A transform that duplicates every byte
| 442 | struct 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 | |
| 456 | struct SwappingTransform { |
nothing calls this directly
no test coverage detected