viirya commented on PR #2883:
URL: https://github.com/apache/arrow-rs/pull/2883#issuecomment-1279883368
> As written this PR is unsound, as `PrimitiveArray::values` requires the
values pointer to be correctly aligned.
The alignment soundness in `PrimitiveArray::values` is guaranteed by
`is_aligned_and_not_null`. This is how it is implemented:
```
pub(crate) fn is_aligned_and_not_null<T>(ptr: *const T) -> bool {
!ptr.is_null() && ptr.addr() % mem::align_of::<T>() == 0
}
```
It only checks if the ptr address is aligned with type `T`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]