diff options
Diffstat (limited to 'include/mimalloc-internal.h')
-rw-r--r-- | include/mimalloc-internal.h | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/include/mimalloc-internal.h b/include/mimalloc-internal.h index ad9b3ec..151cd00 100644 --- a/include/mimalloc-internal.h +++ b/include/mimalloc-internal.h @@ -314,16 +314,37 @@ static inline mi_page_queue_t* mi_page_queue(const mi_heap_t* heap, size_t size) return &((mi_heap_t*)heap)->pages[_mi_bin(size)]; } + +//----------------------------------------------------------- +// Page flags +//----------------------------------------------------------- static inline uintptr_t mi_page_thread_id(const mi_page_t* page) { - return (page->flags.xthread_id << MI_PAGE_FLAGS_BITS); + return (page->flags & ~MI_PAGE_FLAGS_MASK); } static inline void mi_page_init_flags(mi_page_t* page, uintptr_t thread_id) { - page->flags.value = 0; - page->flags.xthread_id = (thread_id >> MI_PAGE_FLAGS_BITS); - mi_assert(page->flags.value == thread_id); + page->flags = thread_id; +} + +static inline bool mi_page_is_in_full(const mi_page_t* page) { + return ((page->flags & 0x01) != 0); +} + +static inline void mi_page_set_in_full(mi_page_t* page, bool in_full) { + if (in_full) page->flags |= 0x01; + else page->flags &= ~0x01; } +static inline bool mi_page_has_aligned(const mi_page_t* page) { + return ((page->flags & 0x02) != 0); +} + +static inline void mi_page_set_has_aligned(mi_page_t* page, bool has_aligned) { + if (has_aligned) page->flags |= 0x02; + else page->flags &= ~0x02; +} + + // ------------------------------------------------------------------- // Encoding/Decoding the free list next pointers // ------------------------------------------------------------------- |