0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-29 10:12:39 +01:00

ircd::spirit: Use better alignment for function object allocation.

This commit is contained in:
Jason Volk 2020-11-29 18:16:16 -08:00
parent 966a0e7bdb
commit cf065aedbe

View file

@ -84,7 +84,7 @@ boost::spirit::function<R (args...)>::function(const function &o)
,o ,o
{ {
this->s? this->s?
ircd::aligned_alloc(8, this->s): ircd::aligned_alloc(64, this->s):
std::unique_ptr<char, decltype(&std::free)> std::unique_ptr<char, decltype(&std::free)>
{ {
nullptr, std::free nullptr, std::free
@ -102,8 +102,13 @@ boost::spirit::function<R (args...)> &
boost::spirit::function<R (args...)>::operator=(binder o) boost::spirit::function<R (args...)>::operator=(binder o)
noexcept noexcept
{ {
constexpr auto alignment
{
std::max(std::alignment_of<binder>::value, 64UL)
};
this->s = sizeof(binder); this->s = sizeof(binder);
this->o = ircd::aligned_alloc(8, this->s); this->o = ircd::aligned_alloc(alignment, this->s);
this->f = [](const void *const &o, args&&... a) this->f = [](const void *const &o, args&&... a)
{ {
const auto &object const auto &object