summaryrefslogtreecommitdiffstats
path: root/Include/cpython/longintrepr.h
diff options
context:
space:
mode:
Diffstat (limited to 'Include/cpython/longintrepr.h')
-rw-r--r--Include/cpython/longintrepr.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/Include/cpython/longintrepr.h b/Include/cpython/longintrepr.h
index c60ccc4..357477b 100644
--- a/Include/cpython/longintrepr.h
+++ b/Include/cpython/longintrepr.h
@@ -139,6 +139,44 @@ _PyLong_CompactValue(const PyLongObject *op)
#define PyUnstable_Long_CompactValue _PyLong_CompactValue
+/* --- Import/Export API -------------------------------------------------- */
+
+typedef struct PyLongLayout {
+ uint8_t bits_per_digit;
+ uint8_t digit_size;
+ int8_t digits_order;
+ int8_t digit_endianness;
+} PyLongLayout;
+
+PyAPI_FUNC(const PyLongLayout*) PyLong_GetNativeLayout(void);
+
+typedef struct PyLongExport {
+ int64_t value;
+ uint8_t negative;
+ Py_ssize_t ndigits;
+ const void *digits;
+ // Member used internally, must not be used for other purpose.
+ Py_uintptr_t _reserved;
+} PyLongExport;
+
+PyAPI_FUNC(int) PyLong_Export(
+ PyObject *obj,
+ PyLongExport *export_long);
+PyAPI_FUNC(void) PyLong_FreeExport(
+ PyLongExport *export_long);
+
+
+/* --- PyLongWriter API --------------------------------------------------- */
+
+typedef struct PyLongWriter PyLongWriter;
+
+PyAPI_FUNC(PyLongWriter*) PyLongWriter_Create(
+ int negative,
+ Py_ssize_t ndigits,
+ void **digits);
+PyAPI_FUNC(PyObject*) PyLongWriter_Finish(PyLongWriter *writer);
+PyAPI_FUNC(void) PyLongWriter_Discard(PyLongWriter *writer);
+
#ifdef __cplusplus
}
#endif