align_down.hpp 551 B

123456789101112131415161718192021222324252627
  1. /*
  2. (c) 2015 Glen Joseph Fernandes
  3. <glenjofe -at- gmail.com>
  4. Distributed under the Boost Software
  5. License, Version 1.0.
  6. http://boost.org/LICENSE_1_0.txt
  7. */
  8. #ifndef BOOST_ALIGN_ALIGN_DOWN_HPP
  9. #define BOOST_ALIGN_ALIGN_DOWN_HPP
  10. #include <boost/align/detail/align_down.hpp>
  11. #include <boost/align/align_down_forward.hpp>
  12. namespace boost {
  13. namespace alignment {
  14. BOOST_CONSTEXPR inline std::size_t align_down(std::size_t value,
  15. std::size_t alignment) BOOST_NOEXCEPT
  16. {
  17. return value & ~(alignment - 1);
  18. }
  19. } /* .alignment */
  20. } /* .boost */
  21. #endif