MCPcopy Create free account
hub / github.com/apache/arrow / MapReadersWriter

Function MapReadersWriter

cpp/src/arrow/util/bitmap_ops.cc:142–172  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

140/// @tparam Op a function of as many input as there are readers.
141template <typename Op>
142void 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
174template <typename Byte = uint8_t>
175struct BitmapPtr {

Callers

nothing calls this directly

Calls 7

PutNextWordMethod · 0.80
trailing_bytesMethod · 0.80
NextTrailingByteMethod · 0.80
PutNextTrailingByteMethod · 0.80
wordsMethod · 0.45
NextWordMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected