diff options
author | Fire-Head <Fire-Head@users.noreply.github.com> | 2019-06-17 15:32:38 +0200 |
---|---|---|
committer | Fire-Head <Fire-Head@users.noreply.github.com> | 2019-06-17 15:32:38 +0200 |
commit | 617eb6951a04d7a76d132aa0f144e7b3c4702925 (patch) | |
tree | fb6444638c35ae1e6a178fabf5d49b0801f666e7 /src/RwHelper.cpp | |
parent | Merge pull request #8 from GTAmodding/master (diff) | |
download | re3-617eb6951a04d7a76d132aa0f144e7b3c4702925.tar re3-617eb6951a04d7a76d132aa0f144e7b3c4702925.tar.gz re3-617eb6951a04d7a76d132aa0f144e7b3c4702925.tar.bz2 re3-617eb6951a04d7a76d132aa0f144e7b3c4702925.tar.lz re3-617eb6951a04d7a76d132aa0f144e7b3c4702925.tar.xz re3-617eb6951a04d7a76d132aa0f144e7b3c4702925.tar.zst re3-617eb6951a04d7a76d132aa0f144e7b3c4702925.zip |
Diffstat (limited to '')
-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) { |