2018-05-22 15:54:19 +00:00
|
|
|
#define NO_JEMALLOC
|
2021-03-09 22:24:35 +00:00
|
|
|
#include "mem.h"
|
2023-10-24 13:18:03 +00:00
|
|
|
|
2018-05-22 15:54:19 +00:00
|
|
|
#include <cstdlib>
|
2018-01-08 13:49:05 +00:00
|
|
|
|
2018-05-18 12:39:17 +00:00
|
|
|
namespace llarp
|
|
|
|
{
|
2018-05-22 15:54:19 +00:00
|
|
|
void
|
2020-04-07 18:38:56 +00:00
|
|
|
Zero(void* ptr, size_t sz)
|
2018-05-18 12:39:17 +00:00
|
|
|
{
|
2020-04-07 18:38:56 +00:00
|
|
|
auto* p = (uint8_t*)ptr;
|
|
|
|
while (sz--)
|
2018-05-18 12:39:17 +00:00
|
|
|
{
|
|
|
|
*p = 0;
|
|
|
|
++p;
|
|
|
|
}
|
|
|
|
}
|
2018-07-09 03:34:29 +00:00
|
|
|
} // namespace llarp
|
2018-05-16 18:13:18 +00:00
|
|
|
|
2018-05-22 15:54:19 +00:00
|
|
|
void
|
2020-04-07 18:38:56 +00:00
|
|
|
llarp_mem_slab(struct llarp_alloc* /*mem*/, uint32_t* /*buf*/, size_t /*sz*/)
|
2018-05-22 15:54:19 +00:00
|
|
|
{
|
|
|
|
// not implemented
|
|
|
|
abort();
|
|
|
|
}
|
2018-05-20 13:43:42 +00:00
|
|
|
|
2018-05-22 15:54:19 +00:00
|
|
|
bool
|
2020-04-07 18:38:56 +00:00
|
|
|
llarp_eq(const void* a, const void* b, size_t sz)
|
2018-05-22 15:54:19 +00:00
|
|
|
{
|
2020-04-07 18:38:56 +00:00
|
|
|
bool result = true;
|
|
|
|
const auto* a_ptr = (const uint8_t*)a;
|
|
|
|
const auto* b_ptr = (const uint8_t*)b;
|
|
|
|
while (sz--)
|
2018-05-20 13:43:42 +00:00
|
|
|
{
|
2018-05-22 15:54:19 +00:00
|
|
|
result &= a_ptr[sz] == b_ptr[sz];
|
2018-05-20 13:43:42 +00:00
|
|
|
}
|
2018-05-22 15:54:19 +00:00
|
|
|
return result;
|
|
|
|
}
|