lokinet/llarp/util/mem.cpp
Stephen Shelton 273270916e
The Great Wall of Blame
This commit reflects changes to clang-format rules. Unfortunately,
these rule changes create a massive change to the codebase, which
causes an apparent rewrite of git history.

Git blame's --ignore-rev flag can be used to ignore this commit when
attempting to `git blame` some code.
2020-04-07 12:38:56 -06:00

38 lines
591 B
C++

#define NO_JEMALLOC
#include <util/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;
}