| 140 | /// @tparam Op a function of as many input as there are readers. |
| 141 | template <typename Op> |
| 142 | void MapReadersWriter(auto&& writer, auto&& reader, auto&&... readers) { |
| 143 | constexpr auto kReaderCount = sizeof...(readers) + 1; |
| 144 | constexpr auto op = Op{}; |
| 145 | |
| 146 | // Need a real function so that the fold expression remains valid in release |
| 147 | [[maybe_unused]] const auto check_eq = [](auto a, auto b) { ARROW_DCHECK_EQ(a, b); }; |
| 148 | |
| 149 | auto nwords = reader.words(); |
| 150 | ((check_eq(readers.words(), nwords)), ...); |
| 151 | while (nwords--) { |
| 152 | writer.PutNextWord(op(reader.NextWord(), readers.NextWord()...)); |
| 153 | } |
| 154 | |
| 155 | auto nbytes = reader.trailing_bytes(); |
| 156 | ((check_eq(readers.trailing_bytes(), nbytes)), ...); |
| 157 | while (nbytes--) { |
| 158 | int valid_bits = 0; |
| 159 | std::array<uint8_t, kReaderCount> bytes = {}; |
| 160 | { |
| 161 | auto b = bytes.begin(); |
| 162 | *b++ = reader.NextTrailingByte(valid_bits); |
| 163 | [[maybe_unused]] auto read = [&](auto& r) { |
| 164 | int vb = 0; |
| 165 | *b++ = r.NextTrailingByte(vb); |
| 166 | check_eq(vb, valid_bits); |
| 167 | }; |
| 168 | (read(readers), ...); |
| 169 | } |
| 170 | writer.PutNextTrailingByte(std::apply(op, bytes), valid_bits); |
| 171 | } |
| 172 | } |
| 173 | |
| 174 | template <typename Byte = uint8_t> |
| 175 | struct BitmapPtr { |
nothing calls this directly
no test coverage detected