Skip to content

Commit c856a4c

Browse files
committed
Copy bound on scalar take
Signed-off-by: Connor Tsui <[email protected]>
1 parent a8ad74f commit c856a4c

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

vortex-compute/src/take/buffer.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22
// SPDX-FileCopyrightText: Copyright the Vortex contributors
33

44
use vortex_buffer::Buffer;
5-
use vortex_dtype::NativePType;
65
use vortex_dtype::UnsignedPType;
76

87
use crate::take::Take;
98

10-
impl<T: NativePType, I: UnsignedPType> Take<[I]> for &Buffer<T> {
9+
impl<T: Copy, I: UnsignedPType> Take<[I]> for &Buffer<T> {
1110
type Output = Buffer<T>;
1211

1312
fn take(self, indices: &[I]) -> Buffer<T> {

vortex-compute/src/take/slice/mod.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
//! Take function implementations on slices.
55
66
use vortex_buffer::Buffer;
7-
use vortex_dtype::NativePType;
87
use vortex_dtype::UnsignedPType;
98

109
use crate::take::Take;
@@ -13,7 +12,7 @@ pub mod avx2;
1312
pub mod portable;
1413

1514
/// Specialized implementation for non-nullable indices.
16-
impl<T: NativePType, I: UnsignedPType> Take<[I]> for &[T] {
15+
impl<T: Copy, I: UnsignedPType> Take<[I]> for &[T] {
1716
type Output = Buffer<T>;
1817

1918
fn take(self, indices: &[I]) -> Buffer<T> {
@@ -40,6 +39,6 @@ impl<T: NativePType, I: UnsignedPType> Take<[I]> for &[T] {
4039
reason = "Compiler may see this as unused based on enabled features"
4140
)]
4241
#[inline]
43-
fn take_scalar<T: NativePType, I: UnsignedPType>(buffer: &[T], indices: &[I]) -> Buffer<T> {
42+
fn take_scalar<T: Copy, I: UnsignedPType>(buffer: &[T], indices: &[I]) -> Buffer<T> {
4443
indices.iter().map(|idx| buffer[idx.as_()]).collect()
4544
}

0 commit comments

Comments
 (0)