diff options
author | daan <daanl@outlook.com> | 2019-08-15 22:00:42 -0700 |
---|---|---|
committer | daan <daanl@outlook.com> | 2019-08-15 22:00:42 -0700 |
commit | f2ba95bc64e3e2a4f1d2054cf15eec66cc3b0db4 (patch) | |
tree | 7b1a69226d9c96ba9c17b317390d9111dc08bc9e /include/mimalloc-internal.h | |
parent | 6ee248b012a56becf6a52b60a2a461f75c7cc7dd (diff) |
first working version of new segment allocation
Diffstat (limited to 'include/mimalloc-internal.h')
-rw-r--r-- | include/mimalloc-internal.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/include/mimalloc-internal.h b/include/mimalloc-internal.h index bb60458..e8fa1ba 100644 --- a/include/mimalloc-internal.h +++ b/include/mimalloc-internal.h @@ -254,7 +254,12 @@ static inline mi_slice_t* mi_page_to_slice(mi_page_t* p) { return (mi_slice_t*)(p); } - +static size_t mi_slice_index(const mi_slice_t* slice) { + mi_segment_t* segment = _mi_ptr_segment(slice); + ptrdiff_t index = slice - segment->slices; + mi_assert_internal(index >= 0 && index < (ptrdiff_t)segment->slice_count); + return index; +} // Segment belonging to a page static inline mi_segment_t* _mi_page_segment(const mi_page_t* page) { |