#ifndef MEMORY_H
#define MEMORY_H

#define MEMZERO_STRUCT(ptr) MEMZERO((ptr), sizeof(*(ptr)))
#define MEMZERO_ARRAY(a) MEMZERO((a), sizeof((a)))
#define MEMZERO(ptr, count) MEMSET((ptr), 0, (count))

#define MEMCPY_STRUCT(ptr_dest, ptr_src) MEMCPY((ptr_dest), (ptr_src), sizeof(*(ptr_dest)));
#define MEMCPY(dest, src, count) memcpy((dest), (src), (count))

#define MEMCMP_STRUCT(p1, p2) MEMCMP((p1), (p2), sizeof(*p1))
#define MEMCMP(p1, p2, n) memcmp((p1), (p2), (n))

#define MEMSET(ptr, val, count) memset((ptr), (val), (count))

#if CRTLIB
# include <memory.h>
#else
void *memcpy(void *__restrict dest, const void *__restrict src, u64 n);
void *memset(void *dest, i32 c, u64 n);
i32 memcmp(const void *p1, const void *p2, u64 n);
#endif

#endif
