MCPcopy Create free account
hub / github.com/OpenDriveLab/OpenLane / __Pyx_PyInt_From_siz

Function __Pyx_PyInt_From_siz

eval/CIPO_evaluation/pycocotools/_mask.c:13698–13726  ·  view source on GitHub ↗

CIntToPy */

Source from the content-addressed store, hash-verified

13696
13697/* CIntToPy */
13698 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_siz(siz value) {
13699 const siz neg_one = (siz) ((siz) 0 - (siz) 1), const_zero = (siz) 0;
13700 const int is_unsigned = neg_one > const_zero;
13701 if (is_unsigned) {
13702 if (sizeof(siz) < sizeof(long)) {
13703 return PyInt_FromLong((long) value);
13704 } else if (sizeof(siz) <= sizeof(unsigned long)) {
13705 return PyLong_FromUnsignedLong((unsigned long) value);
13706#ifdef HAVE_LONG_LONG
13707 } else if (sizeof(siz) <= sizeof(unsigned PY_LONG_LONG)) {
13708 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
13709#endif
13710 }
13711 } else {
13712 if (sizeof(siz) <= sizeof(long)) {
13713 return PyInt_FromLong((long) value);
13714#ifdef HAVE_LONG_LONG
13715 } else if (sizeof(siz) <= sizeof(PY_LONG_LONG)) {
13716 return PyLong_FromLongLong((PY_LONG_LONG) value);
13717#endif
13718 }
13719 }
13720 {
13721 int one = 1; int little = (int)*(unsigned char *)&one;
13722 unsigned char *bytes = (unsigned char *)&value;
13723 return _PyLong_FromByteArray(bytes, sizeof(siz),
13724 little, !is_unsigned);
13725 }
13726}
13727
13728/* CIntToPy */
13729 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value) {

Calls

no outgoing calls

Tested by

no test coverage detected