| 31 | namespace arrow::internal { |
| 32 | |
| 33 | Result<int64_t> ComputeShapeProduct(std::span<const int64_t> shape) { |
| 34 | int64_t product = 1; |
| 35 | for (const auto dim : shape) { |
| 36 | if (MultiplyWithOverflow(product, dim, &product)) { |
| 37 | return Status::Invalid( |
| 38 | "Product of tensor shape dimensions would not fit in 64-bit integer"); |
| 39 | } |
| 40 | } |
| 41 | return product; |
| 42 | } |
| 43 | |
| 44 | bool IsPermutationTrivial(std::span<const int64_t> permutation) { |
| 45 | for (size_t i = 1; i < permutation.size(); ++i) { |
no test coverage detected