1 /** 2 Mirror _longintrepr.h 3 */ 4 module deimos.python.longintrepr; 5 6 import deimos.python.pyport; 7 import deimos.python.object; 8 import deimos.python.unicodeobject; 9 10 extern(C): 11 // Python-header-file: Include/longintrepr.h: 12 13 /** Long integer representation. 14 The absolute value of a number is equal to 15 SUM(for i=0 through abs(ob_size)-1) ob_digit[i] * 2**(SHIFT*i) 16 Negative numbers are represented with ob_size < 0; 17 zero is represented by ob_size == 0. 18 In a normalized number, ob_digit[abs(ob_size)-1] (the most significant 19 digit) is never zero. Also, in all cases, for all valid i, 20 0 <= ob_digit[i] <= MASK. 21 The allocation function takes care of allocating extra memory 22 so that ob_digit[0] ... ob_digit[abs(ob_size)-1] are actually available. 23 24 CAUTION: Generic code manipulating subtypes of PyVarObject has to 25 aware that longs abuse ob_size's sign bit. 26 */ 27 struct PyLongObject { 28 mixin PyObject_VAR_HEAD; 29 ushort[1] ob_digit; 30 } 31 32 /// _ 33 PyLongObject* _PyLong_New(int); 34 35 /** Return a copy of src. */ 36 PyObject* _PyLong_Copy(PyLongObject* src);