| 779 | } |
| 780 | |
| 781 | static int |
| 782 | _signbit_set(PyArrayObject *arr) |
| 783 | { |
| 784 | static char bitmask = (char) 0x80; |
| 785 | char *ptr; /* points to the npy_byte to test */ |
| 786 | char byteorder; |
| 787 | int elsize; |
| 788 | |
| 789 | elsize = PyArray_DESCR(arr)->elsize; |
| 790 | byteorder = PyArray_DESCR(arr)->byteorder; |
| 791 | ptr = PyArray_DATA(arr); |
| 792 | if (elsize > 1 && |
| 793 | (byteorder == NPY_LITTLE || |
| 794 | (byteorder == NPY_NATIVE && |
| 795 | PyArray_ISNBO(NPY_LITTLE)))) { |
| 796 | ptr += elsize - 1; |
| 797 | } |
| 798 | return ((*ptr & bitmask) != 0); |
| 799 | } |
| 800 | |
| 801 | |
| 802 | /*NUMPY_API |
no test coverage detected