| 71 | } |
| 72 | |
| 73 | arrow::Result<std::shared_ptr<Array>> CreateUnalignedArray(const Array& array) { |
| 74 | // Slicing by 1 would create an invalid array if the type was wider than |
| 75 | // 1 byte so double-check that the array is a 1-byte type |
| 76 | EXPECT_EQ(array.type_id(), Type::UINT8); |
| 77 | BufferVector sliced_buffers(array.data()->buffers.size(), nullptr); |
| 78 | for (std::size_t i = 0; i < array.data()->buffers.size(); ++i) { |
| 79 | if (array.data()->buffers[i]) { |
| 80 | sliced_buffers[i] = SliceBuffer(array.data()->buffers[i], 1, 2); |
| 81 | } |
| 82 | } |
| 83 | auto sliced_array_data = |
| 84 | ArrayData::Make(array.type(), /*length=*/2, std::move(sliced_buffers)); |
| 85 | return MakeArray(std::move(sliced_array_data)); |
| 86 | } |
| 87 | |
| 88 | TEST(BitmapWordAlign, AlignedDataStart) { |
| 89 | alignas(8) char buf[136] = {0}; |