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

Function BitmapAllButOne

cpp/src/arrow/util/bitmap_builders.cc:59–73  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57}
58
59Result<std::shared_ptr<Buffer>> BitmapAllButOne(MemoryPool* pool, int64_t length,
60 int64_t straggler_pos, bool value) {
61 if (straggler_pos < 0 || straggler_pos >= length) {
62 return Status::Invalid("invalid straggler_pos ", straggler_pos);
63 }
64
65 ARROW_ASSIGN_OR_RAISE(auto buffer,
66 AllocateBuffer(bit_util::BytesForBits(length), pool));
67
68 auto bitmap_data = buffer->mutable_data();
69 bit_util::SetBitsTo(bitmap_data, 0, length, value);
70 bit_util::SetBitTo(bitmap_data, straggler_pos, !value);
71 // R build with openSUSE155 requires an explicit shared_ptr construction
72 return std::shared_ptr<Buffer>(std::move(buffer));
73}
74
75} // namespace internal
76} // namespace arrow

Callers 1

ComputeNullBitmapFunction · 0.85

Calls 4

SetBitsToFunction · 0.70
SetBitToFunction · 0.70
InvalidFunction · 0.50
mutable_dataMethod · 0.45

Tested by

no test coverage detected