Skip to content

Commit

Permalink
inline PrimitiveArray::value (#329)
Browse files Browse the repository at this point in the history
  • Loading branch information
ritchie46 authored and alamb committed May 25, 2021
1 parent 305b41e commit b632436
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions arrow/src/array/array_primitive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ impl<T: ArrowPrimitiveType> PrimitiveArray<T> {
/// # Safety
///
/// caller must ensure that the passed in offset is less than the array len()
#[inline]
pub unsafe fn value_unchecked(&self, i: usize) -> T::Native {
let offset = i + self.offset();
*self.raw_values.as_ptr().add(offset)
Expand All @@ -103,6 +104,7 @@ impl<T: ArrowPrimitiveType> PrimitiveArray<T> {
/// Note this doesn't do any bound checking, for performance reason.
/// # Safety
/// caller must ensure that the passed in offset is less than the array len()
#[inline]
pub fn value(&self, i: usize) -> T::Native {
debug_assert!(i < self.len());
unsafe { self.value_unchecked(i) }
Expand Down

0 comments on commit b632436

Please sign in to comment.