aligned_alloc_msvc.hpp 709 B

12345678910111213141516171819202122232425262728293031323334
  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_ALIGNED_ALLOC_MSVC_HPP
  8. #define BOOST_ALIGN_DETAIL_ALIGNED_ALLOC_MSVC_HPP
  9. #include <boost/align/detail/is_alignment.hpp>
  10. #include <boost/assert.hpp>
  11. #include <malloc.h>
  12. namespace boost {
  13. namespace alignment {
  14. inline void*
  15. aligned_alloc(std::size_t alignment, std::size_t size) BOOST_NOEXCEPT
  16. {
  17. BOOST_ASSERT(detail::is_alignment(alignment));
  18. return ::_aligned_malloc(size, alignment);
  19. }
  20. inline void
  21. aligned_free(void* ptr) BOOST_NOEXCEPT
  22. {
  23. ::_aligned_free(ptr);
  24. }
  25. } /* alignment */
  26. } /* boost */
  27. #endif