diff options
-rw-r--r-- | src/pso/THeap.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/pso/THeap.cpp b/src/pso/THeap.cpp index 54772ff..8dd0894 100644 --- a/src/pso/THeap.cpp +++ b/src/pso/THeap.cpp @@ -6,8 +6,6 @@ #undef MATCHING #define MATCHING -static const int heap_offset = 8; - THeap *obj_heap; THeap *alt_heap; @@ -28,7 +26,7 @@ void *xmalloc(size_t size) { } void THeap::heap_free(void *ptr) { - #define heap_ptr &ptr_u8[-heap_offset] + #define heap_ptr &ptr_u8[-sizeof(heap_node)] #define ptr_heap ((heap_node *)heap_ptr) const u8 *ptr_u8 = (u8 *)ptr; if (ptr == NULL) { @@ -70,7 +68,7 @@ void *THeap::heap_zalloc(size_t size) { void *THeap::heap_alloc(size_t size) { heap_node *prev_node = heap_nodes; heap_node *node; - u32 size_align = (heap_offset - 1) + align + size; + u32 size_align = (sizeof(heap_node) - 1) + align + size; u32 aligned_size = size_align & -align; goto start; @@ -164,6 +162,6 @@ THeap::THeap(size_t size, int alignment) { heap_nodes->remaining_size = 0; next_tmp_node->next = NULL; - next_tmp_node->remaining_size = size - heap_offset; + next_tmp_node->remaining_size = size - sizeof(heap_node); } } |