Skip to content

Commit c32e491

Browse files
committed
For clarity, give the alignment in terms of _PyGC_PREV_SHIFT rather than a plain number.
Move the definition accordingly.
1 parent 156e38b commit c32e491

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Include/internal/pycore_gc.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ extern "C" {
88
# error "this header requires Py_BUILD_CORE define"
99
#endif
1010

11+
#define _PyGC_PREV_SHIFT 2
12+
#define _PyGC_PREV_MASK (((uintptr_t) -1) << _PyGC_PREV_SHIFT)
13+
1114
/* GC information is stored BEFORE the object structure. */
1215
typedef struct {
1316
// Tagged pointer to next object in the list.
@@ -18,7 +21,7 @@ typedef struct {
1821
// Lowest two bits are used for flags documented later.
1922
// Those two bits are made available by the struct's minimum alignment.
2023
uintptr_t _gc_prev;
21-
} PyGC_Head Py_ALIGNED(4);
24+
} PyGC_Head Py_ALIGNED(1 << _PyGC_PREV_SHIFT);
2225

2326
#define _PyGC_Head_UNUSED PyGC_Head
2427

@@ -142,9 +145,6 @@ static inline void _PyObject_GC_SET_SHARED(PyObject *op) {
142145
*/
143146
#define _PyGC_NEXT_MASK_OLD_SPACE_1 1
144147

145-
#define _PyGC_PREV_SHIFT 2
146-
#define _PyGC_PREV_MASK (((uintptr_t) -1) << _PyGC_PREV_SHIFT)
147-
148148
/* set for debugging information */
149149
#define _PyGC_DEBUG_STATS (1<<0) /* print collection statistics */
150150
#define _PyGC_DEBUG_COLLECTABLE (1<<1) /* print collectable objects */

0 commit comments

Comments
 (0)