1
1
Fork 0
mirror of https://github.com/oxen-io/lokinet synced 2023-12-14 06:53:00 +01:00
lokinet/llarp/util/mem.cpp
michael-loki 0195152e05 Allow builds on MSVC (#518)
* Import cxxopts to replace getopts usage

* Add visual studio build things

* Fixup abseil build parts

* Replace __attribute__((unused)) with ABSL_ATTRIBUTE_UNUSED

* Fixup minor windows build issues

* Replace getopts usage

* Temporarily fixup .rc files

* More minor windows fixes

* Get a working build

* Revert .rc files

* Revert changes to nodedb
2019-04-19 13:24:33 -05:00

42 lines
729 B
C++

#define NO_JEMALLOC
#include <util/mem.h>
#include <cstdlib>
#include <absl/base/attributes.h>
namespace llarp
{
void
Zero(void *ptr, size_t sz)
{
uint8_t *p = (uint8_t *)ptr;
while(sz--)
{
*p = 0;
++p;
}
}
} // namespace llarp
void
llarp_mem_slab(ABSL_ATTRIBUTE_UNUSED struct llarp_alloc *mem,
ABSL_ATTRIBUTE_UNUSED uint32_t *buf,
ABSL_ATTRIBUTE_UNUSED size_t sz)
{
// not implemented
abort();
}
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--)
{
result &= a_ptr[sz] == b_ptr[sz];
}
return result;
}