lokinet/llarp/util/mem.cpp
Thomas Winget 7caa87862e standardize include format and pragma once
All #ifndef guards on headers have been removed, I think,
in favor of #pragma once

Headers are now included as `#include "filename"` if the included file
resides in the same directory as the file including it, or any
subdirectory therein.  Otherwise they are included as
`#include <project/top/dir/relative/path/filename>`

The above does not include system/os headers.
2021-03-09 19:01:41 -05:00

38 lines
586 B
C++

#define NO_JEMALLOC
#include "mem.h"
#include <cstdlib>
namespace llarp
{
void
Zero(void* ptr, size_t sz)
{
auto* p = (uint8_t*)ptr;
while (sz--)
{
*p = 0;
++p;
}
}
} // namespace llarp
void
llarp_mem_slab(struct llarp_alloc* /*mem*/, uint32_t* /*buf*/, size_t /*sz*/)
{
// not implemented
abort();
}
bool
llarp_eq(const void* a, const void* b, size_t sz)
{
bool result = true;
const auto* a_ptr = (const uint8_t*)a;
const auto* b_ptr = (const uint8_t*)b;
while (sz--)
{
result &= a_ptr[sz] == b_ptr[sz];
}
return result;
}