| 57 | } |
| 58 | |
| 59 | Result<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 |
no test coverage detected