diff options
author | Max <mparisi@stevens.edu> | 2020-09-15 13:00:20 -0400 |
---|---|---|
committer | Max <mparisi@stevens.edu> | 2020-09-15 13:00:20 -0400 |
commit | 09e136ea2aa53ab73f3a31be542aeba18e33320c (patch) | |
tree | 02b50e14ca025b2fc1a8253e39545066904f2138 | |
parent | 6bfb788646cc3f6a46a9f8b057f64c43317e80a9 (diff) |
added consts.h
-rw-r--r-- | include/consts.h | 6 | ||||
-rw-r--r-- | src/SDK/OS/OSAlloc.c | 13 |
2 files changed, 12 insertions, 7 deletions
diff --git a/include/consts.h b/include/consts.h new file mode 100644 index 0000000..ed1ac6c --- /dev/null +++ b/include/consts.h @@ -0,0 +1,6 @@ +#ifndef POKEREVO_CONSTS_H
+#define POKEREVO_CONSTS_H
+
+#define OSi_ROUND(n, a) (((u32) (n) + (a) - 1) & ~((a) - 1))
+
+#endif //POKEREVO_CONSTS_H
diff --git a/src/SDK/OS/OSAlloc.c b/src/SDK/OS/OSAlloc.c index e464e48..c553d8d 100644 --- a/src/SDK/OS/OSAlloc.c +++ b/src/SDK/OS/OSAlloc.c @@ -1,13 +1,7 @@ #include "types.h" +#include "consts.h" #include "OS/OSAlloc.h" -#define OSi_ROUND(n, a) (((u32) (n) + (a) - 1) & ~((a) - 1)) - -extern HeapDesc *HeapArray; - -#define HEADERSIZE OSi_ROUND(sizeof(Cell), 32) -#define MINOBJSIZE (HEADERSIZE+32) - inline Cell* DLAddFront(Cell* list, Cell* cell) { cell->next = list; @@ -78,6 +72,11 @@ Cell *DLInsert(Cell *original, Cell *inserted) return inserted; } +extern HeapDesc *HeapArray; + +#define HEADERSIZE OSi_ROUND(sizeof(Cell), 32) +#define MINOBJSIZE (HEADERSIZE+32) + void* OSAllocFromHeap(OSHeapHandle heap, u32 size) { HeapDesc* hd; Cell* cell; |