* Get pointer for an integer index. * * For a purely integer index, set ptr to the memory address. * Returns 0 on success, -1 on failure. * The caller must ensure that the index is a full integer * one. * * @param Array being indexed * @param result pointer * @param parsed index information * @param number of indices * * @return 0 on success -1 on failure */
| 787 | * @return 0 on success -1 on failure |
| 788 | */ |
| 789 | static int |
| 790 | get_item_pointer(PyArrayObject *self, char **ptr, |
| 791 | npy_index_info *indices, int index_num) { |
| 792 | int i; |
| 793 | *ptr = PyArray_BYTES(self); |
| 794 | for (i=0; i < index_num; i++) { |
| 795 | if ((check_and_adjust_index(&(indices[i].value), |
| 796 | PyArray_DIMS(self)[i], i, NULL)) < 0) { |
| 797 | return -1; |
| 798 | } |
| 799 | *ptr += PyArray_STRIDE(self, i) * indices[i].value; |
| 800 | } |
| 801 | return 0; |
| 802 | } |
| 803 | |
| 804 | |
| 805 | /** |
no test coverage detected