diff options
Diffstat (limited to 'boost/align/detail')
31 files changed, 280 insertions, 300 deletions
diff --git a/boost/align/detail/addressof.hpp b/boost/align/detail/addressof.hpp index 50731a70d0..a314830bed 100644 --- a/boost/align/detail/addressof.hpp +++ b/boost/align/detail/addressof.hpp @@ -1,10 +1,9 @@ /* -(c) 2014 Glen Joseph Fernandes -<glenjofe -at- gmail.com> +Copyright 2014 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_DETAIL_ADDRESSOF_HPP #define BOOST_ALIGN_DETAIL_ADDRESSOF_HPP @@ -27,8 +26,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 77055e0328..a58dcea747 100644 --- a/boost/align/detail/align.hpp +++ b/boost/align/detail/align.hpp @@ -1,10 +1,9 @@ /* -(c) 2014-2016 Glen Joseph Fernandes -<glenjofe -at- gmail.com> +Copyright 2014-2016 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_DETAIL_ALIGN_HPP #define BOOST_ALIGN_DETAIL_ALIGN_HPP @@ -15,13 +14,14 @@ http://boost.org/LICENSE_1_0.txt namespace boost { namespace alignment { -inline void* align(std::size_t alignment, std::size_t size, - void*& ptr, std::size_t& space) +inline void* +align(std::size_t alignment, std::size_t size, void*& ptr, + std::size_t& space) { BOOST_ASSERT(detail::is_alignment(alignment)); if (size <= space) { - char* p = (char*)(((std::size_t)ptr + alignment - 1) & - ~(alignment - 1)); + char* p = reinterpret_cast<char*>((reinterpret_cast<std:: + size_t>(ptr) + alignment - 1) & ~(alignment - 1)); std::size_t n = space - (p - static_cast<char*>(ptr)); if (size <= n) { ptr = p; @@ -32,7 +32,7 @@ inline void* align(std::size_t alignment, std::size_t size, return 0; } -} /* .alignment */ -} /* .boost */ +} /* alignment */ +} /* boost */ #endif diff --git a/boost/align/detail/align_cxx11.hpp b/boost/align/detail/align_cxx11.hpp index a95b84c70f..637541ab40 100644 --- a/boost/align/detail/align_cxx11.hpp +++ b/boost/align/detail/align_cxx11.hpp @@ -1,10 +1,9 @@ /* -(c) 2014 Glen Joseph Fernandes -<glenjofe -at- gmail.com> +Copyright 2014 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_DETAIL_ALIGN_CXX11_HPP #define BOOST_ALIGN_DETAIL_ALIGN_CXX11_HPP @@ -16,7 +15,7 @@ namespace alignment { using std::align; -} /* .alignment */ -} /* .boost */ +} /* alignment */ +} /* boost */ #endif diff --git a/boost/align/detail/align_down.hpp b/boost/align/detail/align_down.hpp index 97e1c1d3eb..9a8c358c41 100644 --- a/boost/align/detail/align_down.hpp +++ b/boost/align/detail/align_down.hpp @@ -1,28 +1,28 @@ /* -(c) 2015 Glen Joseph Fernandes -<glenjofe -at- gmail.com> +Copyright 2015 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_DETAIL_ALIGN_DOWN_HPP #define BOOST_ALIGN_DETAIL_ALIGN_DOWN_HPP #include <boost/align/detail/is_alignment.hpp> -#include <boost/align/align_down_forward.hpp> #include <boost/assert.hpp> namespace boost { namespace alignment { -inline void* align_down(void* ptr, std::size_t alignment) BOOST_NOEXCEPT +inline void* +align_down(void* ptr, std::size_t alignment) BOOST_NOEXCEPT { BOOST_ASSERT(detail::is_alignment(alignment)); - return (void*)(align_down((std::size_t)ptr, alignment)); + return reinterpret_cast<void*>(reinterpret_cast<std:: + size_t>(ptr) & ~(alignment - 1)); } -} /* .alignment */ -} /* .boost */ +} /* alignment */ +} /* boost */ #endif diff --git a/boost/align/detail/align_up.hpp b/boost/align/detail/align_up.hpp index e956f7a046..86686da6ae 100644 --- a/boost/align/detail/align_up.hpp +++ b/boost/align/detail/align_up.hpp @@ -1,28 +1,28 @@ /* -(c) 2015 Glen Joseph Fernandes -<glenjofe -at- gmail.com> +Copyright 2015 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_DETAIL_ALIGN_UP_HPP #define BOOST_ALIGN_DETAIL_ALIGN_UP_HPP #include <boost/align/detail/is_alignment.hpp> -#include <boost/align/align_up_forward.hpp> #include <boost/assert.hpp> namespace boost { namespace alignment { -inline void* align_up(void* ptr, std::size_t alignment) BOOST_NOEXCEPT +inline void* +align_up(void* ptr, std::size_t alignment) BOOST_NOEXCEPT { BOOST_ASSERT(detail::is_alignment(alignment)); - return (void*)(align_up((std::size_t)ptr, alignment)); + return reinterpret_cast<void*>((reinterpret_cast<std:: + size_t>(ptr) + alignment - 1) & ~(alignment - 1)); } -} /* .alignment */ -} /* .boost */ +} /* alignment */ +} /* boost */ #endif diff --git a/boost/align/detail/aligned_alloc.hpp b/boost/align/detail/aligned_alloc.hpp index 0488847bbd..69da19659a 100644 --- a/boost/align/detail/aligned_alloc.hpp +++ b/boost/align/detail/aligned_alloc.hpp @@ -1,10 +1,9 @@ /* -(c) 2014-2015 Glen Joseph Fernandes -<glenjofe -at- gmail.com> +Copyright 2014-2015 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_DETAIL_ALIGNED_ALLOC_HPP #define BOOST_ALIGN_DETAIL_ALIGNED_ALLOC_HPP @@ -18,35 +17,36 @@ http://boost.org/LICENSE_1_0.txt namespace boost { namespace alignment { -inline void* aligned_alloc(std::size_t alignment, std::size_t size) - BOOST_NOEXCEPT +inline void* +aligned_alloc(std::size_t alignment, std::size_t size) BOOST_NOEXCEPT { BOOST_ASSERT(detail::is_alignment(alignment)); enum { - min_align = alignment_of<void*>::value + N = alignment_of<void*>::value }; - if (alignment < min_align) { - alignment = min_align; + if (alignment < N) { + alignment = N; } - std::size_t n = size + alignment - min_align; - void* r = 0; + std::size_t n = size + alignment - N; void* p = std::malloc(sizeof(void*) + n); if (p) { - r = static_cast<char*>(p) + sizeof p; + void* r = static_cast<char*>(p) + sizeof(void*); (void)align(alignment, size, r, n); *(static_cast<void**>(r) - 1) = p; + p = r; } - return r; + return p; } -inline void aligned_free(void* ptr) BOOST_NOEXCEPT +inline void +aligned_free(void* ptr) BOOST_NOEXCEPT { if (ptr) { std::free(*(static_cast<void**>(ptr) - 1)); } } -} /* .alignment */ -} /* .boost */ +} /* alignment */ +} /* boost */ #endif diff --git a/boost/align/detail/aligned_alloc_android.hpp b/boost/align/detail/aligned_alloc_android.hpp index 0ed28a45eb..4119fbd9bc 100644 --- a/boost/align/detail/aligned_alloc_android.hpp +++ b/boost/align/detail/aligned_alloc_android.hpp @@ -1,10 +1,9 @@ /* -(c) 2014 Glen Joseph Fernandes -<glenjofe -at- gmail.com> +Copyright 2014 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_DETAIL_ALIGNED_ALLOC_ANDROID_HPP #define BOOST_ALIGN_DETAIL_ALIGNED_ALLOC_ANDROID_HPP @@ -16,19 +15,20 @@ http://boost.org/LICENSE_1_0.txt namespace boost { namespace alignment { -inline void* aligned_alloc(std::size_t alignment, std::size_t size) - BOOST_NOEXCEPT +inline void* +aligned_alloc(std::size_t alignment, std::size_t size) BOOST_NOEXCEPT { BOOST_ASSERT(detail::is_alignment(alignment)); return ::memalign(alignment, size); } -inline void aligned_free(void* ptr) BOOST_NOEXCEPT +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 0bdb7c2eb1..76366fa5c1 100644 --- a/boost/align/detail/aligned_alloc_macos.hpp +++ b/boost/align/detail/aligned_alloc_macos.hpp @@ -1,10 +1,9 @@ /* -(c) 2014 Glen Joseph Fernandes -<glenjofe -at- gmail.com> +Copyright 2014 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_DETAIL_ALIGNED_ALLOC_MACOS_HPP #define BOOST_ALIGN_DETAIL_ALIGNED_ALLOC_MACOS_HPP @@ -16,8 +15,8 @@ http://boost.org/LICENSE_1_0.txt namespace boost { namespace alignment { -inline void* aligned_alloc(std::size_t alignment, std::size_t size) - BOOST_NOEXCEPT +inline void* +aligned_alloc(std::size_t alignment, std::size_t size) BOOST_NOEXCEPT { BOOST_ASSERT(detail::is_alignment(alignment)); if (size == 0) { @@ -33,12 +32,13 @@ inline void* aligned_alloc(std::size_t alignment, std::size_t size) return p; } -inline void aligned_free(void* ptr) BOOST_NOEXCEPT +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 abeccfc4e4..45c57c9915 100644 --- a/boost/align/detail/aligned_alloc_msvc.hpp +++ b/boost/align/detail/aligned_alloc_msvc.hpp @@ -1,10 +1,9 @@ /* -(c) 2014 Glen Joseph Fernandes -<glenjofe -at- gmail.com> +Copyright 2014 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_DETAIL_ALIGNED_ALLOC_MSVC_HPP #define BOOST_ALIGN_DETAIL_ALIGNED_ALLOC_MSVC_HPP @@ -16,19 +15,20 @@ http://boost.org/LICENSE_1_0.txt namespace boost { namespace alignment { -inline void* aligned_alloc(std::size_t alignment, std::size_t size) - BOOST_NOEXCEPT +inline void* +aligned_alloc(std::size_t alignment, std::size_t size) BOOST_NOEXCEPT { BOOST_ASSERT(detail::is_alignment(alignment)); return ::_aligned_malloc(size, alignment); } -inline void aligned_free(void* ptr) BOOST_NOEXCEPT +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 931b0c4bd6..78fc842d20 100644 --- a/boost/align/detail/aligned_alloc_posix.hpp +++ b/boost/align/detail/aligned_alloc_posix.hpp @@ -1,10 +1,9 @@ /* -(c) 2014 Glen Joseph Fernandes -<glenjofe -at- gmail.com> +Copyright 2014 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_DETAIL_ALIGNED_ALLOC_POSIX_HPP #define BOOST_ALIGN_DETAIL_ALIGNED_ALLOC_POSIX_HPP @@ -16,8 +15,8 @@ http://boost.org/LICENSE_1_0.txt namespace boost { namespace alignment { -inline void* aligned_alloc(std::size_t alignment, std::size_t size) - BOOST_NOEXCEPT +inline void* +aligned_alloc(std::size_t alignment, std::size_t size) BOOST_NOEXCEPT { BOOST_ASSERT(detail::is_alignment(alignment)); if (alignment < sizeof(void*)) { @@ -30,12 +29,13 @@ inline void* aligned_alloc(std::size_t alignment, std::size_t size) return p; } -inline void aligned_free(void* ptr) BOOST_NOEXCEPT +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 5039c733c6..0948b40e39 100644 --- a/boost/align/detail/aligned_alloc_sunos.hpp +++ b/boost/align/detail/aligned_alloc_sunos.hpp @@ -1,10 +1,9 @@ /* -(c) 2014 Glen Joseph Fernandes -<glenjofe -at- gmail.com> +Copyright 2014 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_DETAIL_ALIGNED_ALLOC_SUNOS_HPP #define BOOST_ALIGN_DETAIL_ALIGNED_ALLOC_SUNOS_HPP @@ -16,19 +15,20 @@ http://boost.org/LICENSE_1_0.txt namespace boost { namespace alignment { -inline void* aligned_alloc(std::size_t alignment, std::size_t size) - BOOST_NOEXCEPT +inline void* +aligned_alloc(std::size_t alignment, std::size_t size) BOOST_NOEXCEPT { BOOST_ASSERT(detail::is_alignment(alignment)); return ::memalign(alignment, size); } -inline void aligned_free(void* ptr) BOOST_NOEXCEPT +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 f3f6192899..b6fc3dcdcf 100644 --- a/boost/align/detail/alignment_of.hpp +++ b/boost/align/detail/alignment_of.hpp @@ -1,10 +1,9 @@ /* -(c) 2014-2015 Glen Joseph Fernandes -<glenjofe -at- gmail.com> +Copyright 2014-2015 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_DETAIL_ALIGNMENT_OF_HPP #define BOOST_ALIGN_DETAIL_ALIGNMENT_OF_HPP @@ -16,17 +15,17 @@ namespace alignment { namespace detail { template<class T> -struct alignof_helper { +struct offset_value { char value; T object; }; template<class T> struct alignment_of - : min_size<sizeof(T), sizeof(alignof_helper<T>) - sizeof(T)> { }; + : min_size<sizeof(T), sizeof(offset_value<T>) - sizeof(T)> { }; -} /* .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 f550156d73..95773e5ea3 100644 --- a/boost/align/detail/alignment_of_clang.hpp +++ b/boost/align/detail/alignment_of_clang.hpp @@ -1,10 +1,9 @@ /* -(c) 2014 Glen Joseph Fernandes -<glenjofe -at- gmail.com> +Copyright 2014 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_DETAIL_ALIGNMENT_OF_CLANG_HPP #define BOOST_ALIGN_DETAIL_ALIGNMENT_OF_CLANG_HPP @@ -20,8 +19,8 @@ template<class T> 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 8948309d88..ea6f904242 100644 --- a/boost/align/detail/alignment_of_codegear.hpp +++ b/boost/align/detail/alignment_of_codegear.hpp @@ -1,10 +1,9 @@ /* -(c) 2014 Glen Joseph Fernandes -<glenjofe -at- gmail.com> +Copyright 2014 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_DETAIL_ALIGNMENT_OF_CODEGEAR_HPP #define BOOST_ALIGN_DETAIL_ALIGNMENT_OF_CODEGEAR_HPP @@ -20,8 +19,8 @@ template<class T> 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 cbe2d9e7a8..05c7429385 100644 --- a/boost/align/detail/alignment_of_cxx11.hpp +++ b/boost/align/detail/alignment_of_cxx11.hpp @@ -1,10 +1,9 @@ /* -(c) 2014 Glen Joseph Fernandes -<glenjofe -at- gmail.com> +Copyright 2014 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_DETAIL_ALIGNMENT_OF_CXX11_HPP #define BOOST_ALIGN_DETAIL_ALIGNMENT_OF_CXX11_HPP @@ -17,8 +16,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 ffd8294fe3..66a63a50b1 100644 --- a/boost/align/detail/alignment_of_gcc.hpp +++ b/boost/align/detail/alignment_of_gcc.hpp @@ -1,10 +1,9 @@ /* -(c) 2014 Glen Joseph Fernandes -<glenjofe -at- gmail.com> +Copyright 2014 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_DETAIL_ALIGNMENT_OF_GCC_HPP #define BOOST_ALIGN_DETAIL_ALIGNMENT_OF_GCC_HPP @@ -20,8 +19,8 @@ template<class T> 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 cdd7c477ce..1526c7c296 100644 --- a/boost/align/detail/alignment_of_msvc.hpp +++ b/boost/align/detail/alignment_of_msvc.hpp @@ -1,10 +1,9 @@ /* -(c) 2014-2015 Glen Joseph Fernandes -<glenjofe -at- gmail.com> +Copyright 2014-2015 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_DETAIL_ALIGNMENT_OF_MSVC_HPP #define BOOST_ALIGN_DETAIL_ALIGNMENT_OF_MSVC_HPP @@ -16,7 +15,7 @@ namespace alignment { namespace detail { template<class T> -struct alignof_helper { +struct offset_value { T first; char value; T second; @@ -25,10 +24,10 @@ struct alignof_helper { template<class T> struct alignment_of : min_size<sizeof(T), - sizeof(alignof_helper<T>) - (sizeof(T) << 1)> { }; + sizeof(offset_value<T>) - (sizeof(T) << 1)> { }; -} /* .detail */ -} /* .alignment */ -} /* .boost */ +} /* detail */ +} /* alignment */ +} /* boost */ #endif diff --git a/boost/align/detail/assume_aligned.hpp b/boost/align/detail/assume_aligned.hpp index a1c632b94d..d218d8c64e 100644 --- a/boost/align/detail/assume_aligned.hpp +++ b/boost/align/detail/assume_aligned.hpp @@ -1,17 +1,16 @@ /* -(c) 2015 NumScale SAS -(c) 2015 LRI UMR 8623 CNRS/University Paris Sud XI +Copyright 2015 NumScale SAS +Copyright 2015 LRI UMR 8623 CNRS/University Paris Sud XI -(c) 2015 Glen Joseph Fernandes -<glenjofe -at- gmail.com> +Copyright 2015 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_DETAIL_ASSUME_ALIGNED_HPP #define BOOST_ALIGN_DETAIL_ASSUME_ALIGNED_HPP -#define BOOST_ALIGN_ASSUME_ALIGNED(p, n) +#define BOOST_ALIGN_ASSUME_ALIGNED(ptr, alignment) #endif diff --git a/boost/align/detail/assume_aligned_clang.hpp b/boost/align/detail/assume_aligned_clang.hpp index d57cf4f8e5..4c7159fa28 100644 --- a/boost/align/detail/assume_aligned_clang.hpp +++ b/boost/align/detail/assume_aligned_clang.hpp @@ -1,17 +1,16 @@ /* -(c) 2015 Glen Joseph Fernandes -<glenjofe -at- gmail.com> +Copyright 2015 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_DETAIL_ASSUME_ALIGNED_CLANG_HPP #define BOOST_ALIGN_DETAIL_ASSUME_ALIGNED_CLANG_HPP #if __has_builtin(__builtin_assume_aligned) #define BOOST_ALIGN_ASSUME_ALIGNED(p, n) \ -(p) = (__typeof__(p))(__builtin_assume_aligned((p), (n))) +(p) = static_cast<__typeof__(p)>(__builtin_assume_aligned((p), (n))) #else #define BOOST_ALIGN_ASSUME_ALIGNED(p, n) #endif diff --git a/boost/align/detail/assume_aligned_gcc.hpp b/boost/align/detail/assume_aligned_gcc.hpp index fc6d76a07f..117344447a 100644 --- a/boost/align/detail/assume_aligned_gcc.hpp +++ b/boost/align/detail/assume_aligned_gcc.hpp @@ -1,18 +1,17 @@ /* -(c) 2015 NumScale SAS -(c) 2015 LRI UMR 8623 CNRS/University Paris Sud XI +Copyright 2015 NumScale SAS +Copyright 2015 LRI UMR 8623 CNRS/University Paris Sud XI -(c) 2015 Glen Joseph Fernandes -<glenjofe -at- gmail.com> +Copyright 2015 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_DETAIL_ASSUME_ALIGNED_GCC_HPP #define BOOST_ALIGN_DETAIL_ASSUME_ALIGNED_GCC_HPP #define BOOST_ALIGN_ASSUME_ALIGNED(p, n) \ -(p) = (__typeof__(p))(__builtin_assume_aligned((p), (n))) +(p) = static_cast<__typeof__(p)>(__builtin_assume_aligned((p), (n))) #endif diff --git a/boost/align/detail/assume_aligned_intel.hpp b/boost/align/detail/assume_aligned_intel.hpp index 1944f3de51..6792ce005c 100644 --- a/boost/align/detail/assume_aligned_intel.hpp +++ b/boost/align/detail/assume_aligned_intel.hpp @@ -1,18 +1,17 @@ /* -(c) 2015 NumScale SAS -(c) 2015 LRI UMR 8623 CNRS/University Paris Sud XI +Copyright 2015 NumScale SAS +Copyright 2015 LRI UMR 8623 CNRS/University Paris Sud XI -(c) 2015 Glen Joseph Fernandes -<glenjofe -at- gmail.com> +Copyright 2015 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_DETAIL_ASSUME_ALIGNED_INTEL_HPP #define BOOST_ALIGN_DETAIL_ASSUME_ALIGNED_INTEL_HPP -#define BOOST_ALIGN_ASSUME_ALIGNED(p, n) \ -__assume_aligned((p), (n)) +#define BOOST_ALIGN_ASSUME_ALIGNED(ptr, alignment) \ +__assume_aligned((ptr), (alignment)) #endif diff --git a/boost/align/detail/assume_aligned_msvc.hpp b/boost/align/detail/assume_aligned_msvc.hpp index e953333b02..75ac7e1242 100644 --- a/boost/align/detail/assume_aligned_msvc.hpp +++ b/boost/align/detail/assume_aligned_msvc.hpp @@ -1,20 +1,19 @@ /* -(c) 2015 NumScale SAS -(c) 2015 LRI UMR 8623 CNRS/University Paris Sud XI +Copyright 2015 NumScale SAS +Copyright 2015 LRI UMR 8623 CNRS/University Paris Sud XI -(c) 2015 Glen Joseph Fernandes -<glenjofe -at- gmail.com> +Copyright 2015 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_DETAIL_ASSUME_ALIGNED_MSVC_HPP #define BOOST_ALIGN_DETAIL_ASSUME_ALIGNED_MSVC_HPP #include <cstddef> -#define BOOST_ALIGN_ASSUME_ALIGNED(p, n) \ -__assume(((std::size_t)(p) & ((n) - 1)) == 0) +#define BOOST_ALIGN_ASSUME_ALIGNED(ptr, alignment) \ +__assume((reinterpret_cast<std::size_t>(ptr) & ((alignment) - 1)) == 0) #endif diff --git a/boost/align/detail/element_type.hpp b/boost/align/detail/element_type.hpp index 69995e1613..5b2b732da0 100644 --- a/boost/align/detail/element_type.hpp +++ b/boost/align/detail/element_type.hpp @@ -1,10 +1,9 @@ /* -(c) 2015 Glen Joseph Fernandes -<glenjofe -at- gmail.com> +Copyright 2015 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_DETAIL_ELEMENT_TYPE_HPP #define BOOST_ALIGN_DETAIL_ELEMENT_TYPE_HPP @@ -49,45 +48,44 @@ struct remove_all_extents { }; template<class T> -struct remove_all_extents<T[]> - : remove_all_extents<T> { }; +struct remove_all_extents<T[]> { + typedef typename remove_all_extents<T>::type type; +}; template<class T, std::size_t N> -struct remove_all_extents<T[N]> - : remove_all_extents<T> { }; +struct remove_all_extents<T[N]> { + typedef typename remove_all_extents<T>::type type; +}; template<class T> -struct remove_const { +struct remove_cv { typedef T type; }; template<class T> -struct remove_const<const T> { +struct remove_cv<const T> { typedef T type; }; template<class T> -struct remove_volatile { +struct remove_cv<volatile T> { typedef T type; }; template<class T> -struct remove_volatile<volatile T> { +struct remove_cv<const volatile T> { typedef T type; }; - -template<class T> -struct remove_cv - : remove_volatile<typename remove_const<T>::type> { }; #endif template<class T> -struct element_type - : remove_cv<typename remove_all_extents<typename - remove_reference<T>::type>::type> { }; +struct element_type { + typedef typename remove_cv<typename remove_all_extents<typename + remove_reference<T>::type>::type>::type type; +}; -} /* .detail */ -} /* .alignment */ -} /* .boost */ +} /* detail */ +} /* alignment */ +} /* boost */ #endif diff --git a/boost/align/detail/integral_constant.hpp b/boost/align/detail/integral_constant.hpp index 1ad67e330f..860096783e 100644 --- a/boost/align/detail/integral_constant.hpp +++ b/boost/align/detail/integral_constant.hpp @@ -1,10 +1,9 @@ /* -(c) 2014-2016 Glen Joseph Fernandes -<glenjofe -at- gmail.com> +Copyright 2014-2016 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_DETAIL_INTEGRAL_CONSTANT_HPP #define BOOST_ALIGN_DETAIL_INTEGRAL_CONSTANT_HPP @@ -37,10 +36,13 @@ struct integral_constant { BOOST_STATIC_CONSTEXPR T value = Value; }; + +template<class T, T Value> +BOOST_CONSTEXPR_OR_CONST T integral_constant<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 e7c7dd60a0..61982c4685 100644 --- a/boost/align/detail/is_aligned.hpp +++ b/boost/align/detail/is_aligned.hpp @@ -1,36 +1,34 @@ /* -(c) 2014 Glen Joseph Fernandes -<glenjofe -at- gmail.com> +Copyright 2014 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_DETAIL_IS_ALIGNED_HPP #define BOOST_ALIGN_DETAIL_IS_ALIGNED_HPP #include <boost/align/detail/is_alignment.hpp> -#include <boost/align/is_aligned_forward.hpp> #include <boost/assert.hpp> namespace boost { namespace alignment { -inline bool is_aligned(const void* ptr, std::size_t alignment) - BOOST_NOEXCEPT +inline bool +is_aligned(const void* ptr, std::size_t alignment) BOOST_NOEXCEPT { BOOST_ASSERT(detail::is_alignment(alignment)); - return is_aligned((std::size_t)ptr, alignment); + return (reinterpret_cast<std::size_t>(ptr) & (alignment - 1)) == 0; } -inline bool is_aligned(std::size_t alignment, const void* ptr) - BOOST_NOEXCEPT +inline bool +is_aligned(std::size_t alignment, const void* ptr) BOOST_NOEXCEPT { BOOST_ASSERT(detail::is_alignment(alignment)); - return is_aligned((std::size_t)ptr, alignment); + return (reinterpret_cast<std::size_t>(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 12d8df974f..8bedba19c3 100644 --- a/boost/align/detail/is_alignment.hpp +++ b/boost/align/detail/is_alignment.hpp @@ -1,10 +1,10 @@ /* -(c) 2014 Glen Joseph Fernandes -<glenjofe -at- gmail.com> +Copyright 2014 Glen Joseph Fernandes +(glenjofe@gmail.com) + +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt */ #ifndef BOOST_ALIGN_DETAIL_IS_ALIGNMENT_HPP #define BOOST_ALIGN_DETAIL_IS_ALIGNMENT_HPP @@ -16,14 +16,14 @@ namespace boost { namespace alignment { namespace detail { -BOOST_CONSTEXPR inline bool is_alignment(std::size_t value) - BOOST_NOEXCEPT +BOOST_CONSTEXPR inline bool +is_alignment(std::size_t value) BOOST_NOEXCEPT { 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 eb709b7bc2..0ded62857e 100644 --- a/boost/align/detail/is_alignment_constant.hpp +++ b/boost/align/detail/is_alignment_constant.hpp @@ -1,10 +1,9 @@ /* -(c) 2014 Glen Joseph Fernandes -<glenjofe -at- gmail.com> +Copyright 2014 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_DETAIL_IS_ALIGNMENT_CONSTANT_HPP #define BOOST_ALIGN_DETAIL_IS_ALIGNMENT_CONSTANT_HPP @@ -20,8 +19,8 @@ template<std::size_t N> 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 d91de0dab5..9c09fec9c9 100644 --- a/boost/align/detail/max_align.hpp +++ b/boost/align/detail/max_align.hpp @@ -1,10 +1,9 @@ /* -(c) 2014-2015 Glen Joseph Fernandes -<glenjofe -at- gmail.com> +Copyright 2014-2015 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_DETAIL_MAX_ALIGN_HPP #define BOOST_ALIGN_DETAIL_MAX_ALIGN_HPP @@ -20,8 +19,8 @@ template<class A, class B> struct max_align : max_size<alignment_of<A>::value, alignment_of<B>::value> { }; -} /* .detail */ -} /* .alignment */ -} /* .boost */ +} /* detail */ +} /* alignment */ +} /* boost */ #endif diff --git a/boost/align/detail/max_objects.hpp b/boost/align/detail/max_objects.hpp index 27d377c5c2..9fdd30e118 100644 --- a/boost/align/detail/max_objects.hpp +++ b/boost/align/detail/max_objects.hpp @@ -1,10 +1,9 @@ /* -(c) 2014 Glen Joseph Fernandes -<glenjofe -at- gmail.com> +Copyright 2014 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_DETAIL_MAX_OBJECTS_HPP #define BOOST_ALIGN_DETAIL_MAX_OBJECTS_HPP @@ -21,8 +20,8 @@ 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 index 555aa2c258..22cefdbec5 100644 --- a/boost/align/detail/max_size.hpp +++ b/boost/align/detail/max_size.hpp @@ -1,10 +1,9 @@ /* -(c) 2014-2015 Glen Joseph Fernandes -<glenjofe -at- gmail.com> +Copyright 2014-2015 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_DETAIL_MAX_SIZE_HPP #define BOOST_ALIGN_DETAIL_MAX_SIZE_HPP @@ -20,8 +19,8 @@ template<std::size_t A, std::size_t B> struct max_size : integral_constant<std::size_t, (A > B) ? A : B> { }; -} /* .detail */ -} /* .alignment */ -} /* .boost */ +} /* detail */ +} /* alignment */ +} /* boost */ #endif diff --git a/boost/align/detail/min_size.hpp b/boost/align/detail/min_size.hpp index b20d3cdeaf..5b478fdaf0 100644 --- a/boost/align/detail/min_size.hpp +++ b/boost/align/detail/min_size.hpp @@ -1,10 +1,9 @@ /* -(c) 2014 Glen Joseph Fernandes -<glenjofe -at- gmail.com> +Copyright 2014 Glen Joseph Fernandes +(glenjofe@gmail.com) -Distributed under the Boost Software -License, Version 1.0. -http://boost.org/LICENSE_1_0.txt +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_ALIGN_DETAIL_MIN_SIZE_HPP #define BOOST_ALIGN_DETAIL_MIN_SIZE_HPP @@ -20,8 +19,8 @@ template<std::size_t A, std::size_t B> struct min_size : integral_constant<std::size_t, (A < B) ? A : B> { }; -} /* .detail */ -} /* .alignment */ -} /* .boost */ +} /* detail */ +} /* alignment */ +} /* boost */ #endif |