diff options
Diffstat (limited to 'boost/align')
48 files changed, 396 insertions, 499 deletions
diff --git a/boost/align/align.hpp b/boost/align/align.hpp index 3582dcc051..ee4371091c 100644 --- a/boost/align/align.hpp +++ b/boost/align/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_ALIGN_HPP #define BOOST_ALIGN_ALIGN_HPP diff --git a/boost/align/align_down.hpp b/boost/align/align_down.hpp index f437f8e5b3..355844f8aa 100644 --- a/boost/align/align_down.hpp +++ b/boost/align/align_down.hpp @@ -1,27 +1,25 @@ /* -(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_ALIGN_DOWN_HPP #define BOOST_ALIGN_ALIGN_DOWN_HPP #include <boost/align/detail/align_down.hpp> -#include <boost/align/align_down_forward.hpp> namespace boost { namespace alignment { -BOOST_CONSTEXPR inline std::size_t align_down(std::size_t value, - std::size_t alignment) BOOST_NOEXCEPT +BOOST_CONSTEXPR inline std::size_t +align_down(std::size_t value, std::size_t alignment) BOOST_NOEXCEPT { return value & ~(alignment - 1); } -} /* .alignment */ -} /* .boost */ +} /* alignment */ +} /* boost */ #endif diff --git a/boost/align/align_down_forward.hpp b/boost/align/align_down_forward.hpp deleted file mode 100644 index 6d124e8901..0000000000 --- a/boost/align/align_down_forward.hpp +++ /dev/null @@ -1,24 +0,0 @@ -/* -(c) 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_ALIGN_DOWN_FORWARD_HPP -#define BOOST_ALIGN_ALIGN_DOWN_FORWARD_HPP - -#include <boost/config.hpp> -#include <cstddef> - -namespace boost { -namespace alignment { - -BOOST_CONSTEXPR std::size_t align_down(std::size_t value, - std::size_t alignment) BOOST_NOEXCEPT; - -} /* .alignment */ -} /* .boost */ - -#endif diff --git a/boost/align/align_up.hpp b/boost/align/align_up.hpp index b1cec1911e..6401ea848a 100644 --- a/boost/align/align_up.hpp +++ b/boost/align/align_up.hpp @@ -1,27 +1,25 @@ /* -(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_ALIGN_UP_HPP #define BOOST_ALIGN_ALIGN_UP_HPP #include <boost/align/detail/align_up.hpp> -#include <boost/align/align_up_forward.hpp> namespace boost { namespace alignment { -BOOST_CONSTEXPR inline std::size_t align_up(std::size_t value, - std::size_t alignment) BOOST_NOEXCEPT +BOOST_CONSTEXPR inline std::size_t +align_up(std::size_t value, std::size_t alignment) BOOST_NOEXCEPT { return (value + alignment - 1) & ~(alignment - 1); } -} /* .alignment */ -} /* .boost */ +} /* alignment */ +} /* boost */ #endif diff --git a/boost/align/align_up_forward.hpp b/boost/align/align_up_forward.hpp deleted file mode 100644 index 47fdfcd0ba..0000000000 --- a/boost/align/align_up_forward.hpp +++ /dev/null @@ -1,24 +0,0 @@ -/* -(c) 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_ALIGN_UP_FORWARD_HPP -#define BOOST_ALIGN_ALIGN_UP_FORWARD_HPP - -#include <boost/config.hpp> -#include <cstddef> - -namespace boost { -namespace alignment { - -BOOST_CONSTEXPR std::size_t align_up(std::size_t value, - std::size_t alignment) BOOST_NOEXCEPT; - -} /* .alignment */ -} /* .boost */ - -#endif diff --git a/boost/align/aligned_alloc.hpp b/boost/align/aligned_alloc.hpp index 7f2c0bb363..42128f1b24 100644 --- a/boost/align/aligned_alloc.hpp +++ b/boost/align/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_ALIGNED_ALLOC_HPP #define BOOST_ALIGN_ALIGNED_ALLOC_HPP diff --git a/boost/align/aligned_allocator.hpp b/boost/align/aligned_allocator.hpp index b70ed54230..6d0f788952 100644 --- a/boost/align/aligned_allocator.hpp +++ b/boost/align/aligned_allocator.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_ALIGNED_ALLOCATOR_HPP #define BOOST_ALIGN_ALIGNED_ALLOCATOR_HPP @@ -74,12 +73,12 @@ public: } pointer allocate(size_type size, const_void_pointer = 0) { - void* p = 0; - if (size > 0) { - p = aligned_alloc(min_align, sizeof(T) * size); - if (!p) { - boost::throw_exception(std::bad_alloc()); - } + if (size == 0) { + return 0; + } + void* p = aligned_alloc(min_align, sizeof(T) * size); + if (!p) { + boost::throw_exception(std::bad_alloc()); } return static_cast<T*>(p); } @@ -139,21 +138,23 @@ public: }; }; -template<class T1, class T2, std::size_t Alignment> -inline bool operator==(const aligned_allocator<T1, Alignment>&, - const aligned_allocator<T2, Alignment>&) BOOST_NOEXCEPT +template<class T, class U, std::size_t Alignment> +inline bool +operator==(const aligned_allocator<T, Alignment>&, + const aligned_allocator<U, Alignment>&) BOOST_NOEXCEPT { return true; } -template<class T1, class T2, std::size_t Alignment> -inline bool operator!=(const aligned_allocator<T1, Alignment>&, - const aligned_allocator<T2, Alignment>&) BOOST_NOEXCEPT +template<class T, class U, std::size_t Alignment> +inline bool +operator!=(const aligned_allocator<T, Alignment>&, + const aligned_allocator<U, Alignment>&) BOOST_NOEXCEPT { return false; } -} /* .alignment */ -} /* .boost */ +} /* alignment */ +} /* boost */ #endif diff --git a/boost/align/aligned_allocator_adaptor.hpp b/boost/align/aligned_allocator_adaptor.hpp index b6ddd9c369..8905c215d3 100644 --- a/boost/align/aligned_allocator_adaptor.hpp +++ b/boost/align/aligned_allocator_adaptor.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_ALIGNED_ALLOCATOR_ADAPTOR_HPP #define BOOST_ALIGN_ALIGNED_ALLOCATOR_ADAPTOR_HPP @@ -123,7 +122,8 @@ public: char_ptr p = a.allocate(sizeof p + n); void* r = detail::addressof(*p) + sizeof p; (void)align(min_align, s, r, n); - ::new((void*)(static_cast<char_ptr*>(r) - 1)) char_ptr(p); + ::new(static_cast<void*>(static_cast<char_ptr*>(r) + - 1)) char_ptr(p); return static_cast<pointer>(r); } @@ -142,12 +142,13 @@ public: #endif void* r = detail::addressof(*p) + sizeof p; (void)align(min_align, s, r, n); - ::new((void*)(static_cast<char_ptr*>(r) - 1)) char_ptr(p); + ::new(static_cast<void*>(static_cast<char_ptr*>(r) + - 1)) char_ptr(p); return static_cast<pointer>(r); } void deallocate(pointer ptr, size_type size) { - char_ptr* p = (char_ptr*)ptr - 1; + char_ptr* p = reinterpret_cast<char_ptr*>(ptr) - 1; char_ptr r = *p; p->~char_ptr(); char_alloc a(base()); @@ -156,23 +157,23 @@ public: } }; -template<class A1, class A2, std::size_t Alignment> -inline bool operator==(const aligned_allocator_adaptor<A1, - Alignment>& a, const aligned_allocator_adaptor<A2, - Alignment>& b) BOOST_NOEXCEPT +template<class A, class B, std::size_t Alignment> +inline bool +operator==(const aligned_allocator_adaptor<A, Alignment>& a, + const aligned_allocator_adaptor<B, Alignment>& b) BOOST_NOEXCEPT { return a.base() == b.base(); } -template<class A1, class A2, std::size_t Alignment> -inline bool operator!=(const aligned_allocator_adaptor<A1, - Alignment>& a, const aligned_allocator_adaptor<A2, - Alignment>& b) BOOST_NOEXCEPT +template<class A, class B, std::size_t Alignment> +inline bool +operator!=(const aligned_allocator_adaptor<A, Alignment>& a, + const aligned_allocator_adaptor<B, Alignment>& b) BOOST_NOEXCEPT { 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 d606f09920..f762cd1c3a 100644 --- a/boost/align/aligned_allocator_adaptor_forward.hpp +++ b/boost/align/aligned_allocator_adaptor_forward.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_ALIGNED_ALLOCATOR_ADAPTOR_FORWARD_HPP #define BOOST_ALIGN_ALIGNED_ALLOCATOR_ADAPTOR_FORWARD_HPP @@ -17,7 +16,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 41f917f38c..23add71aaa 100644 --- a/boost/align/aligned_allocator_forward.hpp +++ b/boost/align/aligned_allocator_forward.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_ALIGNED_ALLOCATOR_FORWARD_HPP #define BOOST_ALIGN_ALIGNED_ALLOCATOR_FORWARD_HPP @@ -17,7 +16,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 97b1c4b6ad..385bd557af 100644 --- a/boost/align/aligned_delete.hpp +++ b/boost/align/aligned_delete.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_ALIGNED_DELETE_HPP #define BOOST_ALIGN_ALIGNED_DELETE_HPP @@ -26,7 +25,7 @@ struct aligned_delete { } }; -} /* .alignment */ -} /* .boost */ +} /* alignment */ +} /* boost */ #endif diff --git a/boost/align/aligned_delete_forward.hpp b/boost/align/aligned_delete_forward.hpp index 7334bebdef..d5b766d7f0 100644 --- a/boost/align/aligned_delete_forward.hpp +++ b/boost/align/aligned_delete_forward.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_ALIGNED_DELETE_FORWARD_HPP #define BOOST_ALIGN_ALIGNED_DELETE_FORWARD_HPP @@ -14,7 +13,7 @@ namespace alignment { struct aligned_delete; -} /* .alignment */ -} /* .boost */ +} /* alignment */ +} /* boost */ #endif diff --git a/boost/align/alignment_of.hpp b/boost/align/alignment_of.hpp index 3dd2eb5b41..488df0b9e0 100644 --- a/boost/align/alignment_of.hpp +++ b/boost/align/alignment_of.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_ALIGNMENT_OF_HPP #define BOOST_ALIGN_ALIGNMENT_OF_HPP @@ -39,14 +38,15 @@ namespace alignment { template<class T> struct alignment_of - : detail::alignment_of<typename detail::element_type<T>::type> { }; + : detail::alignment_of<typename + detail::element_type<T>::type>::type { }; #if !defined(BOOST_NO_CXX14_VARIABLE_TEMPLATES) template<class T> constexpr std::size_t alignment_of_v = alignment_of<T>::value; #endif -} /* .alignment */ -} /* .boost */ +} /* alignment */ +} /* boost */ #endif diff --git a/boost/align/alignment_of_forward.hpp b/boost/align/alignment_of_forward.hpp index 7ab227528b..31db15f23c 100644 --- a/boost/align/alignment_of_forward.hpp +++ b/boost/align/alignment_of_forward.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_ALIGNMENT_OF_FORWARD_HPP #define BOOST_ALIGN_ALIGNMENT_OF_FORWARD_HPP @@ -15,7 +14,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 8d9f6ccf43..22e5103654 100644 --- a/boost/align/assume_aligned.hpp +++ b/boost/align/assume_aligned.hpp @@ -1,13 +1,12 @@ /* -(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_ASSUME_ALIGNED_HPP #define BOOST_ALIGN_ASSUME_ALIGNED_HPP 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 diff --git a/boost/align/is_aligned.hpp b/boost/align/is_aligned.hpp index cbace96077..c8266d0eae 100644 --- a/boost/align/is_aligned.hpp +++ b/boost/align/is_aligned.hpp @@ -1,27 +1,26 @@ /* -(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_IS_ALIGNED_HPP #define BOOST_ALIGN_IS_ALIGNED_HPP #include <boost/align/detail/is_aligned.hpp> -#include <boost/align/is_aligned_forward.hpp> namespace boost { namespace alignment { -BOOST_CONSTEXPR inline bool is_aligned(std::size_t value, - std::size_t alignment) BOOST_NOEXCEPT +BOOST_CONSTEXPR inline bool +is_aligned(std::size_t value, std::size_t alignment) BOOST_NOEXCEPT { return (value & (alignment - 1)) == 0; } -} /* .alignment */ -} /* .boost */ +} /* alignment */ +} /* boost */ #endif diff --git a/boost/align/is_aligned_forward.hpp b/boost/align/is_aligned_forward.hpp deleted file mode 100644 index d1bcbc19dd..0000000000 --- a/boost/align/is_aligned_forward.hpp +++ /dev/null @@ -1,24 +0,0 @@ -/* -(c) 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_IS_ALIGNED_FORWARD_HPP -#define BOOST_ALIGN_IS_ALIGNED_FORWARD_HPP - -#include <boost/config.hpp> -#include <cstddef> - -namespace boost { -namespace alignment { - -BOOST_CONSTEXPR bool is_aligned(std::size_t value, - std::size_t alignment) BOOST_NOEXCEPT; - -} /* .alignment */ -} /* .boost */ - -#endif |