Fix memcpy in arena

This commit is contained in:
Krzosa Karol
2024-03-16 11:40:26 +01:00
parent 1b48585308
commit 71d36352cb
3 changed files with 45 additions and 53 deletions

View File

@@ -3,6 +3,4 @@ mkdir build
cd build cd build
cl -Fe:bld.exe ../build_tool/main.cpp -FC -WX -W3 -wd4200 -diagnostics:column -nologo -Zi -D_CRT_SECURE_NO_WARNINGS cl -Fe:bld.exe ../build_tool/main.cpp -FC -WX -W3 -wd4200 -diagnostics:column -nologo -Zi -D_CRT_SECURE_NO_WARNINGS
cd .. cd ..
rem build\bld.exe clear_cache
build\bld.exe build\bld.exe
rem build\bld.exe cc=clang

View File

@@ -4,20 +4,6 @@
#define MA_Assertf(x, ...) assert(x) #define MA_Assertf(x, ...) assert(x)
#endif #endif
#ifndef MA_MemoryZero
#include <string.h>
MA_API void MA_MemoryZero(void *p, size_t size) {
memset(p, 0, size);
}
#endif
#ifndef MA_MemoryCopy
#include <string.h>
MA_API void MA_MemoryCopy(void *dst, void *src, size_t size) {
memcpy(dst, src, size);
}
#endif
#ifndef MA_CMalloc #ifndef MA_CMalloc
#include <stdlib.h> #include <stdlib.h>
#define MA_CMalloc(x) malloc(x) #define MA_CMalloc(x) malloc(x)

View File

@@ -55,6 +55,16 @@ typedef struct MA_SourceLoc MA_SourceLoc;
#endif #endif
#endif #endif
#ifndef MA_MemoryZero
#include <string.h>
#define MA_MemoryZero(p, size) memset(p, 0, size)
#endif
#ifndef MA_MemoryCopy
#include <string.h>
#define MA_MemoryCopy(dst, src, size) memcpy(dst, src, size);
#endif
typedef enum M_AllocatorOp { typedef enum M_AllocatorOp {
M_AllocatorOp_Invalid, M_AllocatorOp_Invalid,
M_AllocatorOp_Allocate, M_AllocatorOp_Allocate,
@@ -158,8 +168,6 @@ MA_API void MA_PopSize(MA_Arena *arena, size_t size);
MA_API void MA_DeallocateArena(MA_Arena *arena); MA_API void MA_DeallocateArena(MA_Arena *arena);
MA_API void MA_Reset(MA_Arena *arena); MA_API void MA_Reset(MA_Arena *arena);
MA_API void MA_MemoryZero(void *p, size_t size);
MA_API void MA_MemoryCopy(void *dst, void *src, size_t size);
MA_API size_t MA_GetAlignOffset(size_t size, size_t align); MA_API size_t MA_GetAlignOffset(size_t size, size_t align);
MA_API size_t MA_AlignUp(size_t size, size_t align); MA_API size_t MA_AlignUp(size_t size, size_t align);
MA_API size_t MA_AlignDown(size_t size, size_t align); MA_API size_t MA_AlignDown(size_t size, size_t align);