summaryrefslogtreecommitdiff
path: root/include/mimalloc-types.h
diff options
context:
space:
mode:
authordaan <daanl@outlook.com>2019-10-17 16:48:16 -0700
committerdaan <daanl@outlook.com>2019-10-17 16:48:16 -0700
commit5de851a84d20835de2429ed60a6eeac3b0a8b6eb (patch)
treea1fbbc1dc5c53deceb4de41db5ece72bf0b179a3 /include/mimalloc-types.h
parent93b4281b82768023563bc2eb4a1441d83f53efa4 (diff)
update page_flags to have more portable definition
Diffstat (limited to 'include/mimalloc-types.h')
-rw-r--r--include/mimalloc-types.h21
1 files changed, 9 insertions, 12 deletions
diff --git a/include/mimalloc-types.h b/include/mimalloc-types.h
index c2df634..eea76a2 100644
--- a/include/mimalloc-types.h
+++ b/include/mimalloc-types.h
@@ -131,17 +131,13 @@ typedef enum mi_delayed_e {
// The `in_full` and `has_aligned` page flags are put in a union to efficiently
-// test if both are false (`value == 0`) in the `mi_free` routine.
-typedef struct mi_page_flags_s {
- #pragma warning(suppress:4201)
- union {
- uint8_t full_aligned;
- struct {
- uint8_t in_full : 1;
- uint8_t has_aligned : 1;
- };
- };
- bool is_zero; // `true` if the blocks in the free list are zero initialized
+// test if both are false (`full_aligned == 0`) in the `mi_free` routine.
+typedef union mi_page_flags_s {
+ uint8_t full_aligned;
+ struct {
+ uint8_t in_full : 1;
+ uint8_t has_aligned : 1;
+ } x;
} mi_page_flags_t;
// Thread free list.
@@ -177,7 +173,8 @@ typedef struct mi_page_s {
// layout like this to optimize access in `mi_malloc` and `mi_free`
uint16_t capacity; // number of blocks committed, must be the first field, see `segment.c:page_clear`
uint16_t reserved; // number of blocks reserved in memory
- mi_page_flags_t flags; // `in_full` and `has_aligned` flags (16 bits)
+ mi_page_flags_t flags; // `in_full` and `has_aligned` flags (8 bits)
+ bool is_zero; // `true` if the blocks in the free list are zero initialized
mi_block_t* free; // list of available free blocks (`malloc` allocates from this list)
#if MI_SECURE