Debian Codegraph @

src/frozendict/c_src/3_10/cpython_src/other.c

raw
1 static const unsigned int BitLengthTable[32] = {
2 0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4,
3 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
4 };
5
6 unsigned int _Py_bit_length(unsigned long d) {
7 unsigned int d_bits = 0;
8 while (d >= 32) {
9 d_bits += 6;
10 d >>= 6;
11 }
12 d_bits += BitLengthTable[d];
13 return d_bits;
14 }
15
16 typedef struct {
17 uintptr_t _gc_next;
18 uintptr_t _gc_prev;
19 } PyGC_Head;
20
21 #define _Py_AS_GC(o) ((PyGC_Head *)(o)-1)
22 #define _PyObject_GC_IS_TRACKED(o) (_Py_AS_GC(o)->_gc_next != 0)
23
24 #define _PyObject_GC_MAY_BE_TRACKED(obj) \
25 (PyObject_IS_GC(obj) && \
26 (!PyTuple_CheckExact(obj) || _PyObject_GC_IS_TRACKED(obj)))