| 601 | } |
| 602 | |
| 603 | static inline size_t _mi_usable_size(const void* p, const char* msg) mi_attr_noexcept { |
| 604 | if (p == NULL) return 0; |
| 605 | const mi_segment_t* const segment = mi_checked_ptr_segment(p, msg); |
| 606 | const mi_page_t* const page = _mi_segment_page_of(segment, p); |
| 607 | if mi_likely(!mi_page_has_aligned(page)) { |
| 608 | const mi_block_t* block = (const mi_block_t*)p; |
| 609 | return mi_page_usable_size_of(page, block); |
| 610 | } |
| 611 | else { |
| 612 | // split out to separate routine for improved code generation |
| 613 | return mi_page_usable_aligned_size_of(segment, page, p); |
no test coverage detected