NUMPY_API * Multiply a List of Non-negative numbers with over-flow detection. */
| 194 | * Multiply a List of Non-negative numbers with over-flow detection. |
| 195 | */ |
| 196 | NPY_NO_EXPORT npy_intp |
| 197 | PyArray_OverflowMultiplyList(npy_intp const *l1, int n) |
| 198 | { |
| 199 | npy_intp prod = 1; |
| 200 | int i; |
| 201 | |
| 202 | for (i = 0; i < n; i++) { |
| 203 | npy_intp dim = l1[i]; |
| 204 | |
| 205 | if (dim == 0) { |
| 206 | return 0; |
| 207 | } |
| 208 | if (npy_mul_sizes_with_overflow(&prod, prod, dim)) { |
| 209 | return -1; |
| 210 | } |
| 211 | } |
| 212 | return prod; |
| 213 | } |
| 214 | |
| 215 | /*NUMPY_API |
| 216 | * Produce a pointer into array |
no outgoing calls
no test coverage detected