picop.cylong#
Fast int / long C-API helpers.
- picop.cylong.int_eq(a, b)#
Return True if
a == b— thin alias oflong_eq(same semantics).
- picop.cylong.long_as_double(pylong)#
Return the C
doubleof an integer (PyLong_AsDouble).Notes
Slower than the plain-Python equivalent
float(x)(Tier A 1.03x); hands Cython a C integer type.
- picop.cylong.long_as_long(pylong)#
Return the C
longof an integer (PyLong_AsLong).Notes
Slower than the plain-Python equivalent
int(x)(Tier A 1.12x); hands Cython a C integer type.
- picop.cylong.long_as_long_overflow(pylong)#
Return
(value, overflow)viaPyLong_AsLongAndOverflow.
- picop.cylong.long_as_longlong(pylong)#
Return a
long longviaPyLong_AsLongLong.Notes
Slower than the plain-Python equivalent
int(x)(Tier A 1.83x); hands Cython a C integer type.
- picop.cylong.long_as_ssize(pylong)#
Return the
Py_ssize_tof an integer (PyLong_AsSsize_t).Notes
Slower than the plain-Python equivalent
int(x)(Tier A 1.13x); hands Cython a C integer type.
- picop.cylong.long_as_ulong(pylong)#
Return an unsigned long via
PyLong_AsUnsignedLong.Notes
Slower than the plain-Python equivalent
int(x)(Tier A 1.12x); hands Cython a C integer type.
- picop.cylong.long_as_ulong_mask(io)#
Return
PyLong_AsUnsignedLongMask.Notes
Wraps on overflow and does not raise — trusted-caller. See Safety.
- picop.cylong.long_as_ulonglong(pylong)#
Return an
unsigned long longviaPyLong_AsUnsignedLongLong.Notes
Slower than the plain-Python equivalent
int(x)(Tier A 1.83x); hands Cython a C integer type.
- picop.cylong.long_as_ulonglong_mask(io)#
Return
PyLong_AsUnsignedLongLongMask.Notes
Wraps on overflow and does not raise — trusted-caller. See Safety.
- picop.cylong.long_check_exact(p)#
Return True if
type(p) is int(PyLong_CheckExact); False forbool.
- picop.cylong.long_eq(a, b)#
Return True if integers are equal (identity short-circuit + richcompare).
- picop.cylong.long_from_double(v)#
Return a Python int from a C
double(PyLong_FromDouble).Notes
Slower than the plain-Python equivalent
int(x)(Tier A 1.04x); hands Cython a C integer type.
- picop.cylong.long_from_long(v)#
Return a Python int from a C
long(PyLong_FromLong).Notes
Slower than the plain-Python equivalent
int(x)(Tier A 1.07x); hands Cython a C integer type.
- picop.cylong.long_from_longlong(v)#
Return an
intfromlong longviaPyLong_FromLongLong.Notes
Slower than the plain-Python equivalent
int(x)(Tier A 1.58x); hands Cython a C integer type.
- picop.cylong.long_from_size(v)#
Return an
intfromsize_tviaPyLong_FromSize_t.Notes
Slower than the plain-Python equivalent
int(x)(Tier A 1.08x); hands Cython a C integer type.
- picop.cylong.long_from_ssize(v)#
Return a Python int from a
Py_ssize_t(PyLong_FromSsize_t).Notes
Slower than the plain-Python equivalent
int(x)(Tier A 1.09x); hands Cython a C integer type.
- picop.cylong.long_from_ulong(v)#
Return an
intfrom an unsigned long viaPyLong_FromUnsignedLong.Notes
Slower than the plain-Python equivalent
int(x)(Tier A 1.06x); hands Cython a C integer type.
- picop.cylong.long_from_ulonglong(v)#
Return an
intfromunsigned long longviaPyLong_FromUnsignedLongLong.Notes
Slower than the plain-Python equivalent
int(x)(Tier A 1.59x); hands Cython a C integer type.
- picop.cylong.long_is_negative(value)#
Return whether an integer is negative (
PyLong_IsNegative).
- picop.cylong.long_is_positive(value)#
Return whether an integer is positive (
PyLong_IsPositive).