align_down.hpp 506 B

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