| 9829 | using unique_tag = detail::inheritance_unique_cast_function; |
| 9830 | |
| 9831 | inline void* align(std::size_t alignment, std::size_t size, void*& ptr, std::size_t& space, std::size_t& required_space) { |
| 9832 | // this handels arbitrary alignments... |
| 9833 | // make this into a power-of-2-only? |
| 9834 | // actually can't: this is a C++14-compatible framework, |
| 9835 | // power of 2 alignment is C++17 |
| 9836 | std::uintptr_t initial = reinterpret_cast<std::uintptr_t>(ptr); |
| 9837 | std::uintptr_t offby = static_cast<std::uintptr_t>(initial % alignment); |
| 9838 | std::uintptr_t padding = (alignment - offby) % alignment; |
| 9839 | required_space += size + padding; |
| 9840 | if (space < required_space) { |
| 9841 | return nullptr; |
| 9842 | } |
| 9843 | ptr = static_cast<void*>(static_cast<char*>(ptr) + padding); |
| 9844 | space -= padding; |
| 9845 | return ptr; |
| 9846 | } |
| 9847 | |
| 9848 | inline void* align(std::size_t alignment, std::size_t size, void*& ptr, std::size_t& space) { |
| 9849 | std::size_t required_space = 0; |
no outgoing calls
no test coverage detected