mirror of https://github.com/oxen-io/lokinet
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
700 B
C++
40 lines
700 B
C++
6 years ago
|
#define NO_JEMALLOC
|
||
6 years ago
|
#include <util/mem.h>
|
||
6 years ago
|
#include <cstdlib>
|
||
7 years ago
|
|
||
6 years ago
|
namespace llarp
|
||
|
{
|
||
6 years ago
|
void
|
||
|
Zero(void *ptr, size_t sz)
|
||
6 years ago
|
{
|
||
6 years ago
|
uint8_t *p = (uint8_t *)ptr;
|
||
6 years ago
|
while(sz--)
|
||
|
{
|
||
|
*p = 0;
|
||
|
++p;
|
||
|
}
|
||
|
}
|
||
6 years ago
|
} // namespace llarp
|
||
6 years ago
|
|
||
6 years ago
|
void
|
||
6 years ago
|
llarp_mem_slab(__attribute__((unused)) struct llarp_alloc *mem,
|
||
|
__attribute__((unused)) uint32_t *buf,
|
||
|
__attribute__((unused)) size_t sz)
|
||
6 years ago
|
{
|
||
|
// not implemented
|
||
|
abort();
|
||
|
}
|
||
6 years ago
|
|
||
6 years ago
|
bool
|
||
|
llarp_eq(const void *a, const void *b, size_t sz)
|
||
|
{
|
||
|
bool result = true;
|
||
|
const uint8_t *a_ptr = (const uint8_t *)a;
|
||
|
const uint8_t *b_ptr = (const uint8_t *)b;
|
||
|
while(sz--)
|
||
6 years ago
|
{
|
||
6 years ago
|
result &= a_ptr[sz] == b_ptr[sz];
|
||
6 years ago
|
}
|
||
6 years ago
|
return result;
|
||
|
}
|