| 71 | |
| 72 | template <typename new_type, typename old_type> |
| 73 | typename std::enable_if<(sizeof(old_type) < sizeof(new_type)), Status>::type |
| 74 | AdaptiveIntBuilderBase::ExpandIntSizeInternal() { |
| 75 | int_size_ = sizeof(new_type); |
| 76 | RETURN_NOT_OK(Resize(data_->size() / sizeof(old_type))); |
| 77 | |
| 78 | const old_type* src = reinterpret_cast<old_type*>(raw_data_); |
| 79 | new_type* dst = reinterpret_cast<new_type*>(raw_data_); |
| 80 | // By doing the backward copy, we ensure that no element is overridden during |
| 81 | // the copy process while the copy stays in-place. |
| 82 | std::copy_backward(src, src + length_, dst + length_); |
| 83 | |
| 84 | return Status::OK(); |
| 85 | } |
| 86 | |
| 87 | std::shared_ptr<DataType> AdaptiveUIntBuilder::type() const { |
| 88 | auto int_size = int_size_; |