-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1,629 changed files
with
214,582 additions
and
35,644 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
Copyright 2014-2015 Glen Joseph Fernandes | ||
([email protected]) | ||
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 | ||
|
||
#include <boost/config.hpp> | ||
|
||
#if !defined(BOOST_NO_CXX11_STD_ALIGN) && !defined(BOOST_LIBSTDCXX_VERSION) | ||
#include <boost/align/detail/align_cxx11.hpp> | ||
#else | ||
#include <boost/align/detail/align.hpp> | ||
#endif | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
Copyright 2014-2015 Glen Joseph Fernandes | ||
([email protected]) | ||
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 | ||
|
||
#include <boost/config.hpp> | ||
|
||
#if defined(BOOST_HAS_UNISTD_H) | ||
#include <unistd.h> | ||
#endif | ||
|
||
#if defined(__APPLE__) || defined(__APPLE_CC__) || defined(macintosh) | ||
#include <AvailabilityMacros.h> | ||
#endif | ||
|
||
#if defined(BOOST_ALIGN_USE_ALIGN) | ||
#include <boost/align/detail/aligned_alloc.hpp> | ||
#elif defined(BOOST_ALIGN_USE_NEW) | ||
#include <boost/align/detail/aligned_alloc_new.hpp> | ||
#elif defined(_MSC_VER) && !defined(UNDER_CE) | ||
#include <boost/align/detail/aligned_alloc_msvc.hpp> | ||
#elif defined(__MINGW32__) && (__MSVCRT_VERSION__ >= 0x0700) | ||
#include <boost/align/detail/aligned_alloc_msvc.hpp> | ||
#elif defined(__MINGW32__) | ||
#include <boost/align/detail/aligned_alloc_mingw.hpp> | ||
#elif MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 | ||
#include <boost/align/detail/aligned_alloc_posix.hpp> | ||
#elif MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 | ||
#include <boost/align/detail/aligned_alloc_macos.hpp> | ||
#elif defined(__ANDROID__) | ||
#include <boost/align/detail/aligned_alloc_android.hpp> | ||
#elif defined(__SunOS_5_11) || defined(__SunOS_5_12) | ||
#include <boost/align/detail/aligned_alloc_posix.hpp> | ||
#elif defined(sun) || defined(__sun) | ||
#include <boost/align/detail/aligned_alloc_sunos.hpp> | ||
#elif defined(_POSIX_VERSION) | ||
#include <boost/align/detail/aligned_alloc_posix.hpp> | ||
#else | ||
#include <boost/align/detail/aligned_alloc.hpp> | ||
#endif | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
Copyright 2014-2016 Glen Joseph Fernandes | ||
([email protected]) | ||
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 | ||
|
||
#include <boost/align/detail/element_type.hpp> | ||
#include <boost/align/alignment_of_forward.hpp> | ||
|
||
#if defined(_MSC_VER) && defined(__clang__) | ||
#include <boost/align/detail/alignment_of_cxx11.hpp> | ||
#elif defined(BOOST_MSVC) | ||
#include <boost/align/detail/alignment_of_msvc.hpp> | ||
#elif defined(__GNUC__) && defined(__unix__) && !defined(__LP64__) | ||
#include <boost/align/detail/alignment_of.hpp> | ||
#elif defined(BOOST_CLANG) && !defined(__x86_64__) | ||
#include <boost/align/detail/alignment_of.hpp> | ||
#elif !defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS) | ||
#include <boost/align/detail/alignment_of_cxx11.hpp> | ||
#elif defined(__ghs__) && (__GHS_VERSION_NUMBER >= 600) | ||
#include <boost/align/detail/alignment_of_gcc.hpp> | ||
#elif defined(BOOST_CODEGEARC) | ||
#include <boost/align/detail/alignment_of_codegear.hpp> | ||
#elif defined(BOOST_CLANG) | ||
#include <boost/align/detail/alignment_of_clang.hpp> | ||
#elif __GNUC__ > 4 | ||
#include <boost/align/detail/alignment_of_gcc.hpp> | ||
#elif (__GNUC__ == 4) && (__GNUC_MINOR__ >= 3) | ||
#include <boost/align/detail/alignment_of_gcc.hpp> | ||
#else | ||
#include <boost/align/detail/alignment_of.hpp> | ||
#endif | ||
|
||
namespace boost { | ||
namespace alignment { | ||
|
||
template<class T> | ||
struct alignment_of | ||
: 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 */ | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
Copyright 2014 Glen Joseph Fernandes | ||
([email protected]) | ||
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 | ||
|
||
namespace boost { | ||
namespace alignment { | ||
|
||
template<class T> | ||
struct alignment_of; | ||
|
||
} /* alignment */ | ||
} /* boost */ | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
Copyright 2014-2020 Glen Joseph Fernandes | ||
([email protected]) | ||
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 | ||
|
||
#include <boost/align/detail/is_alignment.hpp> | ||
#include <boost/assert.hpp> | ||
|
||
namespace boost { | ||
namespace alignment { | ||
|
||
inline void* | ||
align(std::size_t alignment, std::size_t size, void*& ptr, | ||
std::size_t& space) | ||
{ | ||
BOOST_ASSERT(boost::alignment::detail::is_alignment(alignment)); | ||
if (size <= space) { | ||
char* p = reinterpret_cast<char*>(~(alignment - 1) & | ||
(reinterpret_cast<std::size_t>(ptr) + alignment - 1)); | ||
std::size_t n = p - static_cast<char*>(ptr); | ||
if (n <= space - size) { | ||
ptr = p; | ||
space -= n; | ||
return p; | ||
} | ||
} | ||
return 0; | ||
} | ||
|
||
} /* alignment */ | ||
} /* boost */ | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
Copyright 2014 Glen Joseph Fernandes | ||
([email protected]) | ||
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 | ||
|
||
#include <memory> | ||
|
||
namespace boost { | ||
namespace alignment { | ||
|
||
using std::align; | ||
|
||
} /* alignment */ | ||
} /* boost */ | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
Copyright 2014-2015 Glen Joseph Fernandes | ||
([email protected]) | ||
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 | ||
|
||
#include <boost/align/detail/is_alignment.hpp> | ||
#include <boost/align/align.hpp> | ||
#include <boost/align/alignment_of.hpp> | ||
#include <boost/assert.hpp> | ||
#include <cstdlib> | ||
|
||
namespace boost { | ||
namespace alignment { | ||
|
||
inline void* | ||
aligned_alloc(std::size_t alignment, std::size_t size) BOOST_NOEXCEPT | ||
{ | ||
BOOST_ASSERT(detail::is_alignment(alignment)); | ||
enum { | ||
N = alignment_of<void*>::value | ||
}; | ||
if (alignment < N) { | ||
alignment = N; | ||
} | ||
std::size_t n = size + alignment - N; | ||
void* p = std::malloc(sizeof(void*) + n); | ||
if (p) { | ||
void* r = static_cast<char*>(p) + sizeof(void*); | ||
(void)boost::alignment::align(alignment, size, r, n); | ||
*(static_cast<void**>(r) - 1) = p; | ||
p = r; | ||
} | ||
return p; | ||
} | ||
|
||
inline void | ||
aligned_free(void* ptr) BOOST_NOEXCEPT | ||
{ | ||
if (ptr) { | ||
std::free(*(static_cast<void**>(ptr) - 1)); | ||
} | ||
} | ||
|
||
} /* alignment */ | ||
} /* boost */ | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
Copyright 2014 Glen Joseph Fernandes | ||
([email protected]) | ||
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 | ||
|
||
#include <boost/align/detail/is_alignment.hpp> | ||
#include <boost/assert.hpp> | ||
#include <malloc.h> | ||
|
||
namespace boost { | ||
namespace alignment { | ||
|
||
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 | ||
{ | ||
::free(ptr); | ||
} | ||
|
||
} /* alignment */ | ||
} /* boost */ | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
Copyright 2014 Glen Joseph Fernandes | ||
([email protected]) | ||
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 | ||
|
||
#include <boost/align/detail/is_alignment.hpp> | ||
#include <boost/assert.hpp> | ||
#include <stdlib.h> | ||
|
||
namespace boost { | ||
namespace alignment { | ||
|
||
inline void* | ||
aligned_alloc(std::size_t alignment, std::size_t size) BOOST_NOEXCEPT | ||
{ | ||
BOOST_ASSERT(detail::is_alignment(alignment)); | ||
if (size == 0) { | ||
return 0; | ||
} | ||
if (alignment < sizeof(void*)) { | ||
alignment = sizeof(void*); | ||
} | ||
void* p; | ||
if (::posix_memalign(&p, alignment, size) != 0) { | ||
p = 0; | ||
} | ||
return p; | ||
} | ||
|
||
inline void | ||
aligned_free(void* ptr) BOOST_NOEXCEPT | ||
{ | ||
::free(ptr); | ||
} | ||
|
||
} /* alignment */ | ||
} /* boost */ | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
Copyright 2020 Glen Joseph Fernandes | ||
([email protected]) | ||
Distributed under the Boost Software License, Version 1.0. | ||
(http://www.boost.org/LICENSE_1_0.txt) | ||
*/ | ||
#ifndef BOOST_ALIGN_DETAIL_ALIGNED_ALLOC_MINGW_HPP | ||
#define BOOST_ALIGN_DETAIL_ALIGNED_ALLOC_MINGW_HPP | ||
|
||
#include <boost/align/detail/is_alignment.hpp> | ||
#include <boost/assert.hpp> | ||
#include <malloc.h> | ||
|
||
namespace boost { | ||
namespace alignment { | ||
|
||
inline void* | ||
aligned_alloc(std::size_t alignment, std::size_t size) BOOST_NOEXCEPT | ||
{ | ||
BOOST_ASSERT(detail::is_alignment(alignment)); | ||
return ::__mingw_aligned_malloc(size, alignment); | ||
} | ||
|
||
inline void | ||
aligned_free(void* ptr) BOOST_NOEXCEPT | ||
{ | ||
::__mingw_aligned_free(ptr); | ||
} | ||
|
||
} /* alignment */ | ||
} /* boost */ | ||
|
||
#endif |
Oops, something went wrong.