@@ -8,6 +8,13 @@ extern "C" {
8
8
# error "this header requires Py_BUILD_CORE define"
9
9
#endif
10
10
11
+
12
+ typedef unsigned int pymem_uint ; /* assuming >= 16 bits */
13
+
14
+ #undef uint
15
+ #define uint pymem_uint
16
+
17
+
11
18
/* An object allocator for Python.
12
19
13
20
Here is an introduction to the layers of the Python memory architecture,
@@ -130,7 +137,7 @@ extern "C" {
130
137
#endif
131
138
132
139
/* Return the number of bytes in size class I, as a uint. */
133
- #define INDEX2SIZE (I ) (((uint )(I) + 1) << ALIGNMENT_SHIFT)
140
+ #define INDEX2SIZE (I ) (((pymem_uint )(I) + 1) << ALIGNMENT_SHIFT)
134
141
135
142
/*
136
143
* Max size threshold below which malloc requests are considered to be
@@ -307,7 +314,7 @@ struct arena_object {
307
314
#define POOL_ADDR (P ) ((poolp)_Py_ALIGN_DOWN((P), POOL_SIZE))
308
315
309
316
/* Return total number of blocks in pool of size index I, as a uint. */
310
- #define NUMBLOCKS (I ) ((uint )(POOL_SIZE - POOL_OVERHEAD) / INDEX2SIZE(I))
317
+ #define NUMBLOCKS (I ) ((pymem_uint )(POOL_SIZE - POOL_OVERHEAD) / INDEX2SIZE(I))
311
318
312
319
/*==========================================================================*/
313
320
@@ -657,6 +664,9 @@ struct _obmalloc_state {
657
664
};
658
665
659
666
667
+ #undef uint
668
+
669
+
660
670
/* Allocate memory directly from the O/S virtual memory system,
661
671
* where supported. Otherwise fallback on malloc */
662
672
void * _PyObject_VirtualAlloc (size_t size );
0 commit comments