Make "pal_supports" not a function
But rather a template vardecl, as per C++14
This commit is contained in:
@@ -1120,7 +1120,7 @@ namespace snmalloc
|
||||
else if constexpr (decommit_strategy == DecommitSuperLazy)
|
||||
{
|
||||
static_assert(
|
||||
pal_supports<LowMemoryNotification, MemoryProvider>(),
|
||||
pal_supports<LowMemoryNotification, MemoryProvider>,
|
||||
"A lazy decommit strategy cannot be implemented on platforms "
|
||||
"without low memory notifications");
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace snmalloc
|
||||
// Use flat map is under a single node.
|
||||
# define SNMALLOC_MAX_FLATPAGEMAP_SIZE PAGEMAP_NODE_SIZE
|
||||
#endif
|
||||
static constexpr bool USE_FLATPAGEMAP = pal_supports<LazyCommit>() ||
|
||||
static constexpr bool USE_FLATPAGEMAP = pal_supports<LazyCommit> ||
|
||||
(SNMALLOC_MAX_FLATPAGEMAP_SIZE >=
|
||||
sizeof(FlatPagemap<SUPERSLAB_BITS, uint8_t>));
|
||||
|
||||
|
||||
@@ -190,7 +190,7 @@ namespace snmalloc
|
||||
SNMALLOC_FAST_PATH
|
||||
uint64_t low_memory_epoch()
|
||||
{
|
||||
if constexpr (pal_supports<LowMemoryNotification, PAL>())
|
||||
if constexpr (pal_supports<LowMemoryNotification, PAL>)
|
||||
{
|
||||
return PAL::low_memory_epoch();
|
||||
}
|
||||
@@ -203,7 +203,7 @@ namespace snmalloc
|
||||
template<bool committed>
|
||||
void* reserve(size_t* size, size_t align) noexcept
|
||||
{
|
||||
if constexpr (pal_supports<AlignedAllocation, PAL>())
|
||||
if constexpr (pal_supports<AlignedAllocation, PAL>)
|
||||
{
|
||||
return PAL::template reserve<committed>(size, align);
|
||||
}
|
||||
|
||||
@@ -61,8 +61,5 @@ namespace snmalloc
|
||||
* Query whether the PAL supports a specific feature.
|
||||
*/
|
||||
template<PalFeatures F, typename PAL = Pal>
|
||||
constexpr static bool pal_supports()
|
||||
{
|
||||
return (PAL::pal_features & F) == F;
|
||||
}
|
||||
constexpr static bool pal_supports = (PAL::pal_features & F) == F;
|
||||
} // namespace snmalloc
|
||||
|
||||
Reference in New Issue
Block a user