MCPcopy Create free account
hub / github.com/numpy/numpy / _signbit_set

Function _signbit_set

numpy/core/src/multiarray/multiarraymodule.c:781–799  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

779}
780
781static 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

Callers 1

PyArray_ScalarKindFunction · 0.85

Calls 2

PyArray_DESCRFunction · 0.85
PyArray_DATAFunction · 0.85

Tested by

no test coverage detected