Procs
proc asLongAndOverflow(vv: IntObject; ovlf: var bool): int {.inline, ...raises: [], tags: [], forbids: [].}
- PyLong_AsLongAndOverflow Source Edit
proc toInt(pyInt: IntObject; overflow: var IntSign): int {....raises: [], tags: [], forbids: [].}
- Source Edit
proc toSomeSignedInt[I: SomeSignedInt](pyInt: IntObject; overflow: var IntSign): I
-
if overflow, overflow will be IntSign.Negative or IntSign.Positive (depending the sign of the argument) and result be `-1
Otherwise, overflow will be IntSign.Zero
Source Edit proc toSomeSignedIntUnsafe[T: SomeSignedInt](pyInt: IntObject): T
- XXX: the caller should take care of overflow It raises OverflowDefect on non-danger build Source Edit
proc toSomeUnsignedInt[U: SomeUnsignedInt](pyInt: IntObject; overflow: var IntSign): U
- like toSomeSignedInt<#toInt,IntObject,IntSign>_ but for `uint Source Edit
Templates
template toIntOrRetOF(vv: IntObject): int
- a helper wrapper of PyLong_AsSsize_t return OverflowError for outer function Source Edit
Exports
-
isNil, sign, newInt, sign, newInt, newIntFromPtr, newInt, IntObject, newInt, newIntFromPtr, newIntSimple, SomeIntegerOrObj, PyLong_DECIMAL_BASE, PyLong_SHIFT, PyLong_DECIMAL_SHIFT, byteCount, numbits, bit_count, bit_length, digitCount, isEven, flipSign, isPositive, isZero, setSignNegative, isNegative, isOdd, negate, SDigit, isNil, sign, newInt, sign, newInt, newIntFromPtr, newInt, IntObject, newInt, newIntFromPtr, newIntSimple, truncate, SomeIntegerOrObj, Digit, TwoDigits, PyLong_DECIMAL_BASE, digitBits, IntSign, PyLong_SHIFT, PyLong_DECIMAL_SHIFT, hash, PY_INT_MAX_STR_DIGITS_THRESHOLD, PY_INT_DEFAULT_MAX_STR_DIGITS