Extended TrivialInitAtomic (#340)

This commit is contained in:
Istvan Haller
2021-06-23 10:50:28 +01:00
committed by GitHub
parent 85843e965e
commit 18d7cc99b6

View File

@@ -219,6 +219,21 @@ namespace snmalloc
{
return this->ref().compare_exchange_strong(exp, des, mo);
}
SNMALLOC_FAST_PATH T
exchange(T des, std::memory_order mo = std::memory_order_seq_cst) noexcept
{
return this->ref().exchange(des, mo);
}
template<typename Q>
SNMALLOC_FAST_PATH
typename std::enable_if<std::is_integral<Q>::value, Q>::type
fetch_add(
Q arg, std::memory_order mo = std::memory_order_seq_cst) noexcept
{
return this->ref().fetch_add(arg, mo);
}
};
static_assert(sizeof(TrivialInitAtomic<char>) == sizeof(char));