2727
2828namespace arrow ::internal {
2929
30- bool IsPermutationTrivial (const std::vector< int64_t >& permutation) {
30+ bool IsPermutationTrivial (util::span< const int64_t > permutation) {
3131 for (size_t i = 1 ; i < permutation.size (); ++i) {
3232 if (permutation[i - 1 ] + 1 != permutation[i]) {
3333 return false ;
@@ -36,7 +36,7 @@ bool IsPermutationTrivial(const std::vector<int64_t>& permutation) {
3636 return true ;
3737}
3838
39- Status IsPermutationValid (const std::vector< int64_t >& permutation) {
39+ Status IsPermutationValid (util::span< const int64_t > permutation) {
4040 const auto size = static_cast <int64_t >(permutation.size ());
4141 std::vector<uint8_t > dim_seen (size, 0 );
4242
@@ -53,8 +53,8 @@ Status IsPermutationValid(const std::vector<int64_t>& permutation) {
5353}
5454
5555Result<std::vector<int64_t >> ComputeStrides (const std::shared_ptr<DataType>& value_type,
56- const std::vector< int64_t >& shape,
57- const std::vector< int64_t >& permutation) {
56+ util::span< const int64_t > shape,
57+ util::span< const int64_t > permutation) {
5858 const auto ndim = shape.size ();
5959 const int byte_width = value_type->byte_width ();
6060
@@ -64,11 +64,11 @@ Result<std::vector<int64_t>> ComputeStrides(const std::shared_ptr<DataType>& val
6464 perm.resize (ndim);
6565 std::iota (perm.begin (), perm.end (), 0 );
6666 } else {
67- perm = permutation;
67+ perm. assign (permutation. begin (), permutation. end ()) ;
6868 }
6969
7070 int64_t remaining = 0 ;
71- if (!shape.empty () && shape. front () > 0 ) {
71+ if (!shape.empty () && shape[ 0 ] > 0 ) {
7272 remaining = byte_width;
7373 for (auto i : perm) {
7474 if (i > 0 ) {
0 commit comments