diff options
author | aap <aap@papnet.eu> | 2019-06-17 22:40:31 +0200 |
---|---|---|
committer | aap <aap@papnet.eu> | 2019-06-17 22:40:31 +0200 |
commit | e524a1a3261627b749255a4dbef9690335662ed7 (patch) | |
tree | 614c2732b7e98926b2948e1ffdd885fc11478c2d /src/RwHelper.cpp | |
parent | first part of CFileLoader (diff) | |
parent | Merge pull request #23 from Fire-Head/master (diff) | |
download | re3-e524a1a3261627b749255a4dbef9690335662ed7.tar re3-e524a1a3261627b749255a4dbef9690335662ed7.tar.gz re3-e524a1a3261627b749255a4dbef9690335662ed7.tar.bz2 re3-e524a1a3261627b749255a4dbef9690335662ed7.tar.lz re3-e524a1a3261627b749255a4dbef9690335662ed7.tar.xz re3-e524a1a3261627b749255a4dbef9690335662ed7.tar.zst re3-e524a1a3261627b749255a4dbef9690335662ed7.zip |
Diffstat (limited to 'src/RwHelper.cpp')
-rw-r--r-- | src/RwHelper.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/RwHelper.cpp b/src/RwHelper.cpp index 6a8c7530..5aa31e92 100644 --- a/src/RwHelper.cpp +++ b/src/RwHelper.cpp @@ -4,6 +4,34 @@ #include "TimeCycle.h" #include "skeleton.h" +void * +RwMallocAlign(RwUInt32 size, RwUInt32 align) +{ + void *mem = (void *)malloc(size + align); + + ASSERT(mem != NULL); + + void *addr = (void *)((((RwUInt32)mem) + align) & ~(align - 1)); + + ASSERT(addr != NULL); + + *(((void **)addr) - 1) = mem; + + return addr; +} + +void +RwFreeAlign(void *mem) +{ + ASSERT(mem != NULL); + + void *addr = *(((void **)mem) - 1); + + ASSERT(addr != NULL); + + free(addr); +} + void DefinedState(void) { |