// vim:fileencoding=utf-8:foldmethod=marker

#include "mem_os.h"
#include "mem_os_ops.h"
#include "../../common/aliases/aliases.h"
#include "../../common/platform/platform.h"
#include <assert.h>
#include <string.h>

#if defined(WP_PLATFORM_WINDOWS)
#include "win/mem_os_win.h"
#elif defined(WP_PLATFORM_POSIX)
#include "posix/mem_os_posix.h"
#else
#error "Unrecognised platform"
#endif

void *wpOsMemAlloc(void *addr, u64 size, WpMemAccess access, WpMemAllocFlags flags, WpMemInitType type) {
	void *output = _osMemAllocate(addr, size, access, flags, type);

	if (type == WP_MEM_INIT_INITIALISED) {
		memset(output, 0, size);
	}

	return output;
}

void wpOsMemFree(void *ptr, u64 size) {
	_osMemFree(ptr, size);
}
