diff options
Diffstat (limited to 'boost/align')
43 files changed, 199 insertions, 192 deletions
diff --git a/boost/align/align.hpp b/boost/align/align.hpp index b95d673bcd..648a65e295 100644 --- a/boost/align/align.hpp +++ b/boost/align/align.hpp @@ -1,6 +1,6 @@ /* (c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com +<glenjofe -at- gmail.com> Distributed under the Boost Software License, Version 1.0. diff --git a/boost/align/aligned_alloc.hpp b/boost/align/aligned_alloc.hpp index 0e3ba60641..b70f4bc632 100644 --- a/boost/align/aligned_alloc.hpp +++ b/boost/align/aligned_alloc.hpp @@ -1,6 +1,6 @@ /* (c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com +<glenjofe -at- gmail.com> Distributed under the Boost Software License, Version 1.0. diff --git a/boost/align/aligned_allocator.hpp b/boost/align/aligned_allocator.hpp index a31dfe599f..9655e3dfb2 100644 --- a/boost/align/aligned_allocator.hpp +++ b/boost/align/aligned_allocator.hpp @@ -1,6 +1,6 @@ /* -(c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com +(c) 2014-2015 Glen Joseph Fernandes +<glenjofe -at- gmail.com> Distributed under the Boost Software License, Version 1.0. @@ -17,8 +17,8 @@ http://boost.org/LICENSE_1_0.txt #include <boost/align/alignment_of.hpp> #include <boost/align/detail/addressof.hpp> #include <boost/align/detail/is_alignment_constant.hpp> -#include <boost/align/detail/max_align.hpp> -#include <boost/align/detail/max_count_of.hpp> +#include <boost/align/detail/max_objects.hpp> +#include <boost/align/detail/max_size.hpp> #include <new> #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) @@ -46,7 +46,7 @@ public: private: enum { - min_align = detail::max_align<Alignment, + min_align = detail::max_size<Alignment, alignment_of<value_type>::value>::value }; @@ -57,7 +57,7 @@ public: }; #if !defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) - aligned_allocator() BOOST_NOEXCEPT = default; + aligned_allocator() = default; #else aligned_allocator() BOOST_NOEXCEPT { } @@ -79,18 +79,18 @@ public: pointer allocate(size_type size, const_void_pointer = 0) { void* p = aligned_alloc(min_align, sizeof(T) * size); - if (!p && size > 0) { - boost::throw_exception(std::bad_alloc()); + if (size > 0 && !p) { + ::boost::throw_exception(std::bad_alloc()); } return static_cast<T*>(p); } void deallocate(pointer ptr, size_type) { - alignment::aligned_free(ptr); + ::boost::alignment::aligned_free(ptr); } BOOST_CONSTEXPR size_type max_size() const BOOST_NOEXCEPT { - return detail::max_count_of<T>::value; + return detail::max_objects<T>::value; } #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) @@ -160,7 +160,7 @@ inline bool operator!=(const aligned_allocator<T1, return false; } -} /* :alignment */ -} /* :boost */ +} /* .alignment */ +} /* .boost */ #endif diff --git a/boost/align/aligned_allocator_adaptor.hpp b/boost/align/aligned_allocator_adaptor.hpp index ac77b4ab9e..19777173f1 100644 --- a/boost/align/aligned_allocator_adaptor.hpp +++ b/boost/align/aligned_allocator_adaptor.hpp @@ -1,6 +1,6 @@ /* (c) 2014-2015 Glen Joseph Fernandes -glenjofe at gmail dot com +<glenjofe -at- gmail.com> Distributed under the Boost Software License, Version 1.0. @@ -17,6 +17,7 @@ http://boost.org/LICENSE_1_0.txt #include <boost/align/detail/addressof.hpp> #include <boost/align/detail/is_alignment_constant.hpp> #include <boost/align/detail/max_align.hpp> +#include <boost/align/detail/max_size.hpp> #include <new> #if !defined(BOOST_NO_CXX11_ALLOCATOR) @@ -74,9 +75,8 @@ public: private: enum { - min_align = detail::max_align<Alignment, - detail::max_align<alignment_of<value_type>::value, - alignment_of<char_ptr>::value>::value>::value + min_align = detail::max_size<Alignment, + detail::max_align<value_type, char_ptr>::value>::value }; public: @@ -184,7 +184,7 @@ inline bool operator!=(const aligned_allocator_adaptor<A1, return !(a == b); } -} /* :alignment */ -} /* :boost */ +} /* .alignment */ +} /* .boost */ #endif diff --git a/boost/align/aligned_allocator_adaptor_forward.hpp b/boost/align/aligned_allocator_adaptor_forward.hpp index 327d7edbf9..d606f09920 100644 --- a/boost/align/aligned_allocator_adaptor_forward.hpp +++ b/boost/align/aligned_allocator_adaptor_forward.hpp @@ -1,6 +1,6 @@ /* (c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com +<glenjofe -at- gmail.com> Distributed under the Boost Software License, Version 1.0. @@ -17,7 +17,7 @@ namespace alignment { template<class Allocator, std::size_t Alignment = 1> class aligned_allocator_adaptor; -} /* :alignment */ -} /* :boost */ +} /* .alignment */ +} /* .boost */ #endif diff --git a/boost/align/aligned_allocator_forward.hpp b/boost/align/aligned_allocator_forward.hpp index 9a3f3635db..41f917f38c 100644 --- a/boost/align/aligned_allocator_forward.hpp +++ b/boost/align/aligned_allocator_forward.hpp @@ -1,6 +1,6 @@ /* (c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com +<glenjofe -at- gmail.com> Distributed under the Boost Software License, Version 1.0. @@ -17,7 +17,7 @@ namespace alignment { template<class T, std::size_t Alignment = 1> class aligned_allocator; -} /* :alignment */ -} /* :boost */ +} /* .alignment */ +} /* .boost */ #endif diff --git a/boost/align/aligned_delete.hpp b/boost/align/aligned_delete.hpp index 6d8caed302..c8ad64e4da 100644 --- a/boost/align/aligned_delete.hpp +++ b/boost/align/aligned_delete.hpp @@ -1,6 +1,6 @@ /* (c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com +<glenjofe -at- gmail.com> Distributed under the Boost Software License, Version 1.0. @@ -23,12 +23,12 @@ public: BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(ptr->~T())) { if (ptr) { ptr->~T(); - alignment::aligned_free(ptr); + ::boost::alignment::aligned_free(ptr); } } }; -} /* :alignment */ -} /* :boost */ +} /* .alignment */ +} /* .boost */ #endif diff --git a/boost/align/aligned_delete_forward.hpp b/boost/align/aligned_delete_forward.hpp index 530e0970d3..375e576cb5 100644 --- a/boost/align/aligned_delete_forward.hpp +++ b/boost/align/aligned_delete_forward.hpp @@ -1,6 +1,6 @@ /* (c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com +<glenjofe -at- gmail.com> Distributed under the Boost Software License, Version 1.0. @@ -14,7 +14,7 @@ namespace alignment { class aligned_delete; -} /* :alignment */ -} /* :boost */ +} /* .alignment */ +} /* .boost */ #endif diff --git a/boost/align/alignment_of.hpp b/boost/align/alignment_of.hpp index 06d22a0259..2531ced105 100644 --- a/boost/align/alignment_of.hpp +++ b/boost/align/alignment_of.hpp @@ -1,6 +1,6 @@ /* (c) 2014-2015 Glen Joseph Fernandes -glenjofe at gmail dot com +<glenjofe -at- gmail.com> Distributed under the Boost Software License, Version 1.0. @@ -47,7 +47,7 @@ struct alignment_of type>::type>::type>::type { }; -} /* :alignment */ -} /* :boost */ +} /* .alignment */ +} /* .boost */ #endif diff --git a/boost/align/alignment_of_forward.hpp b/boost/align/alignment_of_forward.hpp index 778a9f73b8..7ab227528b 100644 --- a/boost/align/alignment_of_forward.hpp +++ b/boost/align/alignment_of_forward.hpp @@ -1,6 +1,6 @@ /* (c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com +<glenjofe -at- gmail.com> Distributed under the Boost Software License, Version 1.0. @@ -15,7 +15,7 @@ namespace alignment { template<class T> struct alignment_of; -} /* :alignment */ -} /* :boost */ +} /* .alignment */ +} /* .boost */ #endif diff --git a/boost/align/assume_aligned.hpp b/boost/align/assume_aligned.hpp index 8d730e6d79..8d9f6ccf43 100644 --- a/boost/align/assume_aligned.hpp +++ b/boost/align/assume_aligned.hpp @@ -3,7 +3,7 @@ (c) 2015 LRI UMR 8623 CNRS/University Paris Sud XI (c) 2015 Glen Joseph Fernandes -glenjofe at gmail dot com +<glenjofe -at- gmail.com> Distributed under the Boost Software License, Version 1.0. @@ -16,7 +16,7 @@ http://boost.org/LICENSE_1_0.txt #if defined(BOOST_MSVC) #include <boost/align/detail/assume_aligned_msvc.hpp> -#elif defined(BOOST_CLANG) +#elif defined(BOOST_CLANG) && defined(__has_builtin) #include <boost/align/detail/assume_aligned_clang.hpp> #elif BOOST_GCC_VERSION >= 40700 #include <boost/align/detail/assume_aligned_gcc.hpp> diff --git a/boost/align/detail/address.hpp b/boost/align/detail/address.hpp index 63be1a95d0..b38e571534 100644 --- a/boost/align/detail/address.hpp +++ b/boost/align/detail/address.hpp @@ -1,6 +1,6 @@ /* (c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com +<glenjofe -at- gmail.com> Distributed under the Boost Software License, Version 1.0. @@ -17,13 +17,13 @@ namespace alignment { namespace detail { #if defined(BOOST_HAS_INTPTR_T) -typedef boost::uintptr_t address_t; +typedef boost::uintptr_t address; #else -typedef std::size_t address_t; +typedef std::size_t address; #endif -} /* :detail */ -} /* :alignment */ -} /* :boost */ +} /* .detail */ +} /* .alignment */ +} /* .boost */ #endif diff --git a/boost/align/detail/addressof.hpp b/boost/align/detail/addressof.hpp index 8f0c88204e..50731a70d0 100644 --- a/boost/align/detail/addressof.hpp +++ b/boost/align/detail/addressof.hpp @@ -1,6 +1,6 @@ /* (c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com +<glenjofe -at- gmail.com> Distributed under the Boost Software License, Version 1.0. @@ -27,8 +27,8 @@ using std::addressof; using boost::addressof; #endif -} /* :detail */ -} /* :alignment */ -} /* :boost */ +} /* .detail */ +} /* .alignment */ +} /* .boost */ #endif diff --git a/boost/align/detail/align.hpp b/boost/align/detail/align.hpp index 00be6fd6aa..d2404b3e6d 100644 --- a/boost/align/detail/align.hpp +++ b/boost/align/detail/align.hpp @@ -1,6 +1,6 @@ /* (c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com +<glenjofe -at- gmail.com> Distributed under the Boost Software License, Version 1.0. @@ -21,7 +21,7 @@ inline void* align(std::size_t alignment, std::size_t size, void*& ptr, std::size_t& space) { BOOST_ASSERT(detail::is_alignment(alignment)); - std::size_t n = detail::address_t(ptr) & (alignment - 1); + std::size_t n = detail::address(ptr) & (alignment - 1); if (n != 0) { n = alignment - n; } @@ -34,7 +34,7 @@ inline void* align(std::size_t alignment, std::size_t size, return p; } -} /* :alignment */ -} /* :boost */ +} /* .alignment */ +} /* .boost */ #endif diff --git a/boost/align/detail/align_cxx11.hpp b/boost/align/detail/align_cxx11.hpp index 80dc7e36a4..a95b84c70f 100644 --- a/boost/align/detail/align_cxx11.hpp +++ b/boost/align/detail/align_cxx11.hpp @@ -1,6 +1,6 @@ /* (c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com +<glenjofe -at- gmail.com> Distributed under the Boost Software License, Version 1.0. @@ -16,7 +16,7 @@ namespace alignment { using std::align; -} /* :alignment */ -} /* :boost */ +} /* .alignment */ +} /* .boost */ #endif diff --git a/boost/align/detail/aligned_alloc.hpp b/boost/align/detail/aligned_alloc.hpp index 1852ac15a6..28c0d2938e 100644 --- a/boost/align/detail/aligned_alloc.hpp +++ b/boost/align/detail/aligned_alloc.hpp @@ -1,6 +1,6 @@ /* (c) 2014-2015 Glen Joseph Fernandes -glenjofe at gmail dot com +<glenjofe -at- gmail.com> Distributed under the Boost Software License, Version 1.0. @@ -48,7 +48,7 @@ inline void aligned_free(void* ptr) BOOST_NOEXCEPT } } -} /* :alignment */ -} /* :boost */ +} /* .alignment */ +} /* .boost */ #endif diff --git a/boost/align/detail/aligned_alloc_android.hpp b/boost/align/detail/aligned_alloc_android.hpp index d97d67989e..2381d8be9c 100644 --- a/boost/align/detail/aligned_alloc_android.hpp +++ b/boost/align/detail/aligned_alloc_android.hpp @@ -1,6 +1,6 @@ /* (c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com +<glenjofe -at- gmail.com> Distributed under the Boost Software License, Version 1.0. @@ -30,7 +30,7 @@ inline void aligned_free(void* ptr) BOOST_NOEXCEPT ::free(ptr); } -} /* :alignment */ -} /* :boost */ +} /* .alignment */ +} /* .boost */ #endif diff --git a/boost/align/detail/aligned_alloc_macos.hpp b/boost/align/detail/aligned_alloc_macos.hpp index 9b6d235133..da3270b084 100644 --- a/boost/align/detail/aligned_alloc_macos.hpp +++ b/boost/align/detail/aligned_alloc_macos.hpp @@ -1,6 +1,6 @@ /* (c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com +<glenjofe -at- gmail.com> Distributed under the Boost Software License, Version 1.0. @@ -22,7 +22,7 @@ inline void* aligned_alloc(std::size_t alignment, std::size_t size) BOOST_NOEXCEPT { BOOST_ASSERT(detail::is_alignment(alignment)); - if (!size) { + if (size == 0) { return 0; } if (alignment < sizeof(void*)) { @@ -40,7 +40,7 @@ inline void aligned_free(void* ptr) BOOST_NOEXCEPT ::free(ptr); } -} /* :alignment */ -} /* :boost */ +} /* .alignment */ +} /* .boost */ #endif diff --git a/boost/align/detail/aligned_alloc_msvc.hpp b/boost/align/detail/aligned_alloc_msvc.hpp index 1cb7f2a3a1..92f4291893 100644 --- a/boost/align/detail/aligned_alloc_msvc.hpp +++ b/boost/align/detail/aligned_alloc_msvc.hpp @@ -1,6 +1,6 @@ /* (c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com +<glenjofe -at- gmail.com> Distributed under the Boost Software License, Version 1.0. @@ -30,7 +30,7 @@ inline void aligned_free(void* ptr) BOOST_NOEXCEPT ::_aligned_free(ptr); } -} /* :alignment */ -} /* :boost */ +} /* .alignment */ +} /* .boost */ #endif diff --git a/boost/align/detail/aligned_alloc_posix.hpp b/boost/align/detail/aligned_alloc_posix.hpp index 3743652cbd..df64d75da3 100644 --- a/boost/align/detail/aligned_alloc_posix.hpp +++ b/boost/align/detail/aligned_alloc_posix.hpp @@ -1,6 +1,6 @@ /* (c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com +<glenjofe -at- gmail.com> Distributed under the Boost Software License, Version 1.0. @@ -37,7 +37,7 @@ inline void aligned_free(void* ptr) BOOST_NOEXCEPT ::free(ptr); } -} /* :alignment */ -} /* :boost */ +} /* .alignment */ +} /* .boost */ #endif diff --git a/boost/align/detail/aligned_alloc_sunos.hpp b/boost/align/detail/aligned_alloc_sunos.hpp index c5778cdd75..0114597bad 100644 --- a/boost/align/detail/aligned_alloc_sunos.hpp +++ b/boost/align/detail/aligned_alloc_sunos.hpp @@ -1,6 +1,6 @@ /* (c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com +<glenjofe -at- gmail.com> Distributed under the Boost Software License, Version 1.0. @@ -30,7 +30,7 @@ inline void aligned_free(void* ptr) BOOST_NOEXCEPT ::free(ptr); } -} /* :alignment */ -} /* :boost */ +} /* .alignment */ +} /* .boost */ #endif diff --git a/boost/align/detail/alignment_of.hpp b/boost/align/detail/alignment_of.hpp index b1d2d56920..2a630e9784 100644 --- a/boost/align/detail/alignment_of.hpp +++ b/boost/align/detail/alignment_of.hpp @@ -1,6 +1,6 @@ /* -(c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com +(c) 2014-2015 Glen Joseph Fernandes +<glenjofe -at- gmail.com> Distributed under the Boost Software License, Version 1.0. @@ -10,20 +10,25 @@ http://boost.org/LICENSE_1_0.txt #define BOOST_ALIGN_DETAIL_ALIGNMENT_OF_HPP #include <boost/align/detail/min_size.hpp> -#include <boost/align/detail/offset_object.hpp> namespace boost { namespace alignment { namespace detail { template<class T> +struct alignof_helper { + char value; + T object; +}; + +template<class T> struct alignment_of : min_size<sizeof(T), - sizeof(offset_object<T>) - sizeof(T)>::type { + sizeof(alignof_helper<T>) - sizeof(T)>::type { }; -} /* :detail */ -} /* :alignment */ -} /* :boost */ +} /* .detail */ +} /* .alignment */ +} /* .boost */ #endif diff --git a/boost/align/detail/alignment_of_clang.hpp b/boost/align/detail/alignment_of_clang.hpp index fa96a37d9d..a8e2a349d6 100644 --- a/boost/align/detail/alignment_of_clang.hpp +++ b/boost/align/detail/alignment_of_clang.hpp @@ -1,6 +1,6 @@ /* (c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com +<glenjofe -at- gmail.com> Distributed under the Boost Software License, Version 1.0. @@ -21,8 +21,8 @@ struct alignment_of : integral_constant<std::size_t, __alignof(T)> { }; -} /* :detail */ -} /* :alignment */ -} /* :boost */ +} /* .detail */ +} /* .alignment */ +} /* .boost */ #endif diff --git a/boost/align/detail/alignment_of_codegear.hpp b/boost/align/detail/alignment_of_codegear.hpp index e8986cef66..8875e6c424 100644 --- a/boost/align/detail/alignment_of_codegear.hpp +++ b/boost/align/detail/alignment_of_codegear.hpp @@ -1,6 +1,6 @@ /* (c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com +<glenjofe -at- gmail.com> Distributed under the Boost Software License, Version 1.0. @@ -21,8 +21,8 @@ struct alignment_of : integral_constant<std::size_t, alignof(T)> { }; -} /* :detail */ -} /* :alignment */ -} /* :boost */ +} /* .detail */ +} /* .alignment */ +} /* .boost */ #endif diff --git a/boost/align/detail/alignment_of_cxx11.hpp b/boost/align/detail/alignment_of_cxx11.hpp index 0f66098b67..cbe2d9e7a8 100644 --- a/boost/align/detail/alignment_of_cxx11.hpp +++ b/boost/align/detail/alignment_of_cxx11.hpp @@ -1,6 +1,6 @@ /* (c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com +<glenjofe -at- gmail.com> Distributed under the Boost Software License, Version 1.0. @@ -17,8 +17,8 @@ namespace detail { using std::alignment_of; -} /* :detail */ -} /* :alignment */ -} /* :boost */ +} /* .detail */ +} /* .alignment */ +} /* .boost */ #endif diff --git a/boost/align/detail/alignment_of_gcc.hpp b/boost/align/detail/alignment_of_gcc.hpp index 615968b477..0812fde8e4 100644 --- a/boost/align/detail/alignment_of_gcc.hpp +++ b/boost/align/detail/alignment_of_gcc.hpp @@ -1,6 +1,6 @@ /* (c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com +<glenjofe -at- gmail.com> Distributed under the Boost Software License, Version 1.0. @@ -21,8 +21,8 @@ struct alignment_of : integral_constant<std::size_t, __alignof__(T)> { }; -} /* :detail */ -} /* :alignment */ -} /* :boost */ +} /* .detail */ +} /* .alignment */ +} /* .boost */ #endif diff --git a/boost/align/detail/alignment_of_msvc.hpp b/boost/align/detail/alignment_of_msvc.hpp index 87d6ac8e28..df6912f411 100644 --- a/boost/align/detail/alignment_of_msvc.hpp +++ b/boost/align/detail/alignment_of_msvc.hpp @@ -1,6 +1,6 @@ /* -(c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com +(c) 2014-2015 Glen Joseph Fernandes +<glenjofe -at- gmail.com> Distributed under the Boost Software License, Version 1.0. @@ -10,19 +10,26 @@ http://boost.org/LICENSE_1_0.txt #define BOOST_ALIGN_DETAIL_ALIGNMENT_OF_MSVC_HPP #include <boost/align/detail/min_size.hpp> -#include <boost/align/detail/offset_object.hpp> namespace boost { namespace alignment { namespace detail { template<class T> +struct alignof_helper { + T first; + char value; + T second; +}; + +template<class T> struct alignment_of - : min_size<sizeof(T), offsetof(offset_object<T>, object)>::type { + : min_size<sizeof(T), + sizeof(alignof_helper<T>) - (sizeof(T) << 1)>::type { }; -} /* :detail */ -} /* :alignment */ -} /* :boost */ +} /* .detail */ +} /* .alignment */ +} /* .boost */ #endif diff --git a/boost/align/detail/assume_aligned.hpp b/boost/align/detail/assume_aligned.hpp index 0ecefa1dd0..cf77086624 100644 --- a/boost/align/detail/assume_aligned.hpp +++ b/boost/align/detail/assume_aligned.hpp @@ -3,7 +3,7 @@ (c) 2015 LRI UMR 8623 CNRS/University Paris Sud XI (c) 2015 Glen Joseph Fernandes -glenjofe at gmail dot com +<glenjofe -at- gmail.com> Distributed under the Boost Software License, Version 1.0. diff --git a/boost/align/detail/assume_aligned_clang.hpp b/boost/align/detail/assume_aligned_clang.hpp index d72b4cae86..2ba41c6970 100644 --- a/boost/align/detail/assume_aligned_clang.hpp +++ b/boost/align/detail/assume_aligned_clang.hpp @@ -1,6 +1,6 @@ /* (c) 2015 Glen Joseph Fernandes -glenjofe at gmail dot com +<glenjofe -at- gmail.com> Distributed under the Boost Software License, Version 1.0. @@ -9,11 +9,9 @@ http://boost.org/LICENSE_1_0.txt #ifndef BOOST_ALIGN_DETAIL_ASSUME_ALIGNED_CLANG_HPP #define BOOST_ALIGN_DETAIL_ASSUME_ALIGNED_CLANG_HPP -#include <stdint.h> - -#if defined(__has_builtin) && __has_builtin(__builtin_assume) +#if __has_builtin(__builtin_assume_aligned) #define BOOST_ALIGN_ASSUME_ALIGNED(ptr, alignment) \ -__builtin_assume((uintptr_t(ptr) & ((alignment) - 1)) == 0) +(ptr) = __builtin_assume_aligned((ptr), (alignment)) #else #define BOOST_ALIGN_ASSUME_ALIGNED(ptr, alignment) #endif diff --git a/boost/align/detail/assume_aligned_gcc.hpp b/boost/align/detail/assume_aligned_gcc.hpp index a1e6cb0280..f7a545851c 100644 --- a/boost/align/detail/assume_aligned_gcc.hpp +++ b/boost/align/detail/assume_aligned_gcc.hpp @@ -3,7 +3,7 @@ (c) 2015 LRI UMR 8623 CNRS/University Paris Sud XI (c) 2015 Glen Joseph Fernandes -glenjofe at gmail dot com +<glenjofe -at- gmail.com> Distributed under the Boost Software License, Version 1.0. diff --git a/boost/align/detail/assume_aligned_intel.hpp b/boost/align/detail/assume_aligned_intel.hpp index aaaf331802..e9ec2dbeb4 100644 --- a/boost/align/detail/assume_aligned_intel.hpp +++ b/boost/align/detail/assume_aligned_intel.hpp @@ -3,7 +3,7 @@ (c) 2015 LRI UMR 8623 CNRS/University Paris Sud XI (c) 2015 Glen Joseph Fernandes -glenjofe at gmail dot com +<glenjofe -at- gmail.com> Distributed under the Boost Software License, Version 1.0. diff --git a/boost/align/detail/assume_aligned_msvc.hpp b/boost/align/detail/assume_aligned_msvc.hpp index fdad429b08..97c1fb1add 100644 --- a/boost/align/detail/assume_aligned_msvc.hpp +++ b/boost/align/detail/assume_aligned_msvc.hpp @@ -3,7 +3,7 @@ (c) 2015 LRI UMR 8623 CNRS/University Paris Sud XI (c) 2015 Glen Joseph Fernandes -glenjofe at gmail dot com +<glenjofe -at- gmail.com> Distributed under the Boost Software License, Version 1.0. diff --git a/boost/align/detail/integral_constant.hpp b/boost/align/detail/integral_constant.hpp index 6116fea5f5..3f8bf0a8d9 100644 --- a/boost/align/detail/integral_constant.hpp +++ b/boost/align/detail/integral_constant.hpp @@ -1,6 +1,6 @@ /* -(c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com +(c) 2014-2015 Glen Joseph Fernandes +<glenjofe -at- gmail.com> Distributed under the Boost Software License, Version 1.0. @@ -25,24 +25,18 @@ using std::integral_constant; template<class T, T Value> struct integral_constant { typedef T value_type; - typedef integral_constant<T, Value> type; + typedef integral_constant type; -#if !defined(BOOST_NO_CXX11_CONSTEXPR) - constexpr operator value_type() const { + BOOST_CONSTEXPR operator value_type() const { return Value; } - static constexpr T value = Value; -#else - enum { - value = Value - }; -#endif + static BOOST_CONSTEXPR_OR_CONST T value = Value; }; #endif -} /* :detail */ -} /* :alignment */ -} /* :boost */ +} /* .detail */ +} /* .alignment */ +} /* .boost */ #endif diff --git a/boost/align/detail/is_aligned.hpp b/boost/align/detail/is_aligned.hpp index a861e9f4c8..cb45be3433 100644 --- a/boost/align/detail/is_aligned.hpp +++ b/boost/align/detail/is_aligned.hpp @@ -1,6 +1,6 @@ /* (c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com +<glenjofe -at- gmail.com> Distributed under the Boost Software License, Version 1.0. @@ -22,10 +22,10 @@ inline bool is_aligned(std::size_t alignment, const void* ptr) BOOST_NOEXCEPT { BOOST_ASSERT(detail::is_alignment(alignment)); - return (detail::address_t(ptr) & (alignment - 1)) == 0; + return (detail::address(ptr) & (alignment - 1)) == 0; } -} /* :alignment */ -} /* :boost */ +} /* .alignment */ +} /* .boost */ #endif diff --git a/boost/align/detail/is_alignment.hpp b/boost/align/detail/is_alignment.hpp index 7ac0bb3d12..12d8df974f 100644 --- a/boost/align/detail/is_alignment.hpp +++ b/boost/align/detail/is_alignment.hpp @@ -1,6 +1,6 @@ /* (c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com +<glenjofe -at- gmail.com> Distributed under the Boost Software License, Version 1.0. @@ -22,8 +22,8 @@ BOOST_CONSTEXPR inline bool is_alignment(std::size_t value) return (value > 0) && ((value & (value - 1)) == 0); } -} /* :detail */ -} /* :alignment */ -} /* :boost */ +} /* .detail */ +} /* .alignment */ +} /* .boost */ #endif diff --git a/boost/align/detail/is_alignment_constant.hpp b/boost/align/detail/is_alignment_constant.hpp index 4c703cafc0..2c29343b2d 100644 --- a/boost/align/detail/is_alignment_constant.hpp +++ b/boost/align/detail/is_alignment_constant.hpp @@ -1,6 +1,6 @@ /* (c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com +<glenjofe -at- gmail.com> Distributed under the Boost Software License, Version 1.0. @@ -21,8 +21,8 @@ struct is_alignment_constant : integral_constant<bool, (N > 0) && ((N & (N - 1)) == 0)> { }; -} /* :detail */ -} /* :alignment */ -} /* :boost */ +} /* .detail */ +} /* .alignment */ +} /* .boost */ #endif diff --git a/boost/align/detail/max_align.hpp b/boost/align/detail/max_align.hpp index 4351a5a2ed..daa0413935 100644 --- a/boost/align/detail/max_align.hpp +++ b/boost/align/detail/max_align.hpp @@ -1,6 +1,6 @@ /* -(c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com +(c) 2014-2015 Glen Joseph Fernandes +<glenjofe -at- gmail.com> Distributed under the Boost Software License, Version 1.0. @@ -9,20 +9,21 @@ http://boost.org/LICENSE_1_0.txt #ifndef BOOST_ALIGN_DETAIL_MAX_ALIGN_HPP #define BOOST_ALIGN_DETAIL_MAX_ALIGN_HPP -#include <boost/align/detail/integral_constant.hpp> +#include <boost/align/detail/max_size.hpp> +#include <boost/align/alignment_of.hpp> #include <cstddef> namespace boost { namespace alignment { namespace detail { -template<std::size_t A, std::size_t B> +template<class A, class B> struct max_align - : integral_constant<std::size_t, (A > B) ? A : B> { + : max_size<alignment_of<A>::value, alignment_of<B>::value>::type { }; -} /* :detail */ -} /* :alignment */ -} /* :boost */ +} /* .detail */ +} /* .alignment */ +} /* .boost */ #endif diff --git a/boost/align/detail/max_count_of.hpp b/boost/align/detail/max_objects.hpp index e0ae3bce96..eb56d6fe66 100644 --- a/boost/align/detail/max_count_of.hpp +++ b/boost/align/detail/max_objects.hpp @@ -1,13 +1,13 @@ /* (c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com +<glenjofe -at- gmail.com> Distributed under the Boost Software License, Version 1.0. http://boost.org/LICENSE_1_0.txt */ -#ifndef BOOST_ALIGN_DETAIL_MAX_COUNT_OF_HPP -#define BOOST_ALIGN_DETAIL_MAX_COUNT_OF_HPP +#ifndef BOOST_ALIGN_DETAIL_MAX_OBJECTS_HPP +#define BOOST_ALIGN_DETAIL_MAX_OBJECTS_HPP #include <boost/align/detail/integral_constant.hpp> #include <cstddef> @@ -17,13 +17,13 @@ namespace alignment { namespace detail { template<class T> -struct max_count_of +struct max_objects : integral_constant<std::size_t, ~static_cast<std::size_t>(0) / sizeof(T)> { }; -} /* :detail */ -} /* :alignment */ -} /* :boost */ +} /* .detail */ +} /* .alignment */ +} /* .boost */ #endif diff --git a/boost/align/detail/max_size.hpp b/boost/align/detail/max_size.hpp new file mode 100644 index 0000000000..48fc45e2ee --- /dev/null +++ b/boost/align/detail/max_size.hpp @@ -0,0 +1,28 @@ +/* +(c) 2014-2015 Glen Joseph Fernandes +<glenjofe -at- gmail.com> + +Distributed under the Boost Software +License, Version 1.0. +http://boost.org/LICENSE_1_0.txt +*/ +#ifndef BOOST_ALIGN_DETAIL_MAX_SIZE_HPP +#define BOOST_ALIGN_DETAIL_MAX_SIZE_HPP + +#include <boost/align/detail/integral_constant.hpp> +#include <cstddef> + +namespace boost { +namespace alignment { +namespace detail { + +template<std::size_t A, std::size_t B> +struct max_size + : integral_constant<std::size_t, (A > B) ? A : B> { +}; + +} /* .detail */ +} /* .alignment */ +} /* .boost */ + +#endif diff --git a/boost/align/detail/min_size.hpp b/boost/align/detail/min_size.hpp index 71afe8c686..8ed3e87ab6 100644 --- a/boost/align/detail/min_size.hpp +++ b/boost/align/detail/min_size.hpp @@ -1,6 +1,6 @@ /* (c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com +<glenjofe -at- gmail.com> Distributed under the Boost Software License, Version 1.0. @@ -21,8 +21,8 @@ struct min_size : integral_constant<std::size_t, (A < B) ? A : B> { }; -} /* :detail */ -} /* :alignment */ -} /* :boost */ +} /* .detail */ +} /* .alignment */ +} /* .boost */ #endif diff --git a/boost/align/detail/offset_object.hpp b/boost/align/detail/offset_object.hpp deleted file mode 100644 index 2055edfb4a..0000000000 --- a/boost/align/detail/offset_object.hpp +++ /dev/null @@ -1,26 +0,0 @@ -/* -(c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com - -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt -*/ -#ifndef BOOST_ALIGN_DETAIL_OFFSET_OBJECT_HPP -#define BOOST_ALIGN_DETAIL_OFFSET_OBJECT_HPP - -namespace boost { -namespace alignment { -namespace detail { - -template<class T> -struct offset_object { - char offset; - T object; -}; - -} /* :detail */ -} /* :alignment */ -} /* :boost */ - -#endif diff --git a/boost/align/detail/remove_traits.hpp b/boost/align/detail/remove_traits.hpp index f59d6bf9e8..86a98d459a 100644 --- a/boost/align/detail/remove_traits.hpp +++ b/boost/align/detail/remove_traits.hpp @@ -1,6 +1,6 @@ /* (c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com +<glenjofe -at- gmail.com> Distributed under the Boost Software License, Version 1.0. @@ -85,8 +85,8 @@ struct remove_cv { }; #endif -} /* :detail */ -} /* :alignment */ -} /* :boost */ +} /* .detail */ +} /* .alignment */ +} /* .boost */ #endif diff --git a/boost/align/is_aligned.hpp b/boost/align/is_aligned.hpp index 7473864ca7..5d99847e4a 100644 --- a/boost/align/is_aligned.hpp +++ b/boost/align/is_aligned.hpp @@ -1,6 +1,6 @@ /* (c) 2014 Glen Joseph Fernandes -glenjofe at gmail dot com +<glenjofe -at- gmail.com> Distributed under the Boost Software License, Version 1.0. |