Minor update to clangformat file. (#694)
This commit is contained in:
committed by
GitHub
parent
45dbdb00af
commit
69e280c331
@@ -16,6 +16,7 @@ namespace snmalloc
|
||||
using Alloc = snmalloc::LocalAllocator<snmalloc::StandardConfigClientMeta<
|
||||
ArrayClientMetaDataProvider<std::atomic<size_t>>>>;
|
||||
}
|
||||
|
||||
#define SNMALLOC_PROVIDE_OWN_CONFIG
|
||||
#include <snmalloc/snmalloc.h>
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ int main()
|
||||
|
||||
// Specify type of allocator
|
||||
# define SNMALLOC_PROVIDE_OWN_CONFIG
|
||||
|
||||
namespace snmalloc
|
||||
{
|
||||
class CustomConfig : public CommonConfig
|
||||
|
||||
@@ -27,6 +27,7 @@ namespace snmalloc
|
||||
using Alloc = snmalloc::LocalAllocator<snmalloc::StandardConfigClientMeta<
|
||||
ArrayClientMetaDataProvider<std::atomic<size_t>>>>;
|
||||
}
|
||||
|
||||
# define SNMALLOC_PROVIDE_OWN_CONFIG
|
||||
# include <snmalloc/snmalloc.h>
|
||||
|
||||
|
||||
@@ -12,10 +12,13 @@
|
||||
|
||||
using namespace snmalloc;
|
||||
static constexpr size_t GRANULARITY_BITS = 20;
|
||||
|
||||
struct T
|
||||
{
|
||||
size_t v = 99;
|
||||
|
||||
T(size_t v) : v(v) {}
|
||||
|
||||
T() {}
|
||||
};
|
||||
|
||||
|
||||
@@ -22,28 +22,36 @@ struct NodeRef
|
||||
static constexpr size_t offset = 10000;
|
||||
|
||||
size_t* ptr;
|
||||
|
||||
constexpr NodeRef(size_t* p) : ptr(p) {}
|
||||
|
||||
constexpr NodeRef() : ptr(nullptr) {}
|
||||
|
||||
constexpr NodeRef(const NodeRef& other) : ptr(other.ptr) {}
|
||||
|
||||
constexpr NodeRef(NodeRef&& other) : ptr(other.ptr) {}
|
||||
|
||||
bool operator!=(const NodeRef& other) const
|
||||
{
|
||||
return ptr != other.ptr;
|
||||
}
|
||||
|
||||
NodeRef& operator=(const NodeRef& other)
|
||||
{
|
||||
ptr = other.ptr;
|
||||
return *this;
|
||||
}
|
||||
|
||||
void set(uint16_t val)
|
||||
{
|
||||
*ptr = ((size_t(val) + offset) << 1) + (*ptr & 1);
|
||||
}
|
||||
|
||||
explicit operator uint16_t()
|
||||
{
|
||||
return uint16_t((*ptr >> 1) - offset);
|
||||
}
|
||||
|
||||
explicit operator size_t*()
|
||||
{
|
||||
return ptr;
|
||||
|
||||
@@ -25,6 +25,7 @@ namespace
|
||||
{
|
||||
SNMALLOC_CHECK(0 && "Should never be called!");
|
||||
}
|
||||
|
||||
/**
|
||||
* Sandbox class. Allocates a memory region and an allocator that can
|
||||
* allocate into this from the outside.
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
// Specify type of allocator
|
||||
#define SNMALLOC_PROVIDE_OWN_CONFIG
|
||||
|
||||
namespace snmalloc
|
||||
{
|
||||
using CustomGlobals = FixedRangeConfig<PALNoAlloc<DefaultPal>>;
|
||||
|
||||
@@ -30,6 +30,7 @@ extern "C" void* enclave_malloc(size_t);
|
||||
extern "C" void enclave_free(void*);
|
||||
|
||||
using namespace snmalloc;
|
||||
|
||||
int main()
|
||||
{
|
||||
setup();
|
||||
|
||||
Reference in New Issue
Block a user