is_alignment.hpp 551 B

12345678910111213141516171819202122232425262728
  1. /*
  2. Copyright 2014 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_DETAIL_IS_ALIGNMENT_HPP
  8. #define BOOST_ALIGN_DETAIL_IS_ALIGNMENT_HPP
  9. #include <boost/config.hpp>
  10. #include <cstddef>
  11. namespace boost {
  12. namespace alignment {
  13. namespace detail {
  14. BOOST_CONSTEXPR inline bool
  15. is_alignment(std::size_t value) BOOST_NOEXCEPT
  16. {
  17. return (value > 0) && ((value & (value - 1)) == 0);
  18. }
  19. } /* detail */
  20. } /* alignment */
  21. } /* boost */
  22. #endif