2 (c) 2014-2016 Glen Joseph Fernandes
3 <glenjofe -at- gmail.com>
5 Distributed under the Boost Software
7 http://boost.org/LICENSE_1_0.txt
9 #ifndef BOOST_ALIGN_DETAIL_ALIGN_HPP
10 #define BOOST_ALIGN_DETAIL_ALIGN_HPP
12 #include <boost/align/detail/is_alignment.hpp>
13 #include <boost/assert.hpp>
18 inline void* align(std::size_t alignment, std::size_t size,
19 void*& ptr, std::size_t& space)
21 BOOST_ASSERT(detail::is_alignment(alignment));
23 char* p = (char*)(((std::size_t)ptr + alignment - 1) &
25 std::size_t n = space - (p - static_cast<char*>(ptr));