Skip to content

Commit b6a857b

Browse files
committed
Clarify some things, fix copy/paste typos.
1 parent 4fae833 commit b6a857b

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/libc/allocator_VRAM2.c

+5-7
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55
#include <sys/lcd.h>
66
#include <debug.h>
77

8-
// This allocator uses the 2nd part of the VRAM as the heap. It gives you 76K of memory,
8+
// This allocator uses the 2nd part of the VRAM as another area for heap allocations, providing 76KB more memory,
99
// but requires you to only use the first part of the VRAM for the LCD configured in 8bpp.
1010

11-
#define MALLOC_MINSIZE 6 // minimal size (avoid blocks that are too small)
11+
// minimal size (avoid blocks that are too small)
12+
#define MALLOC_MINSIZE 6
1213

1314
static unsigned int freeslotpos(unsigned int n)
1415
{
@@ -101,9 +102,6 @@ void* _vram2_malloc(const size_t alloc_size)
101102
if (alloc_size == 0)
102103
return NULL;
103104

104-
if (alloc_size == 0xFFFFFF)
105-
return (void*)((heap_ptrend - heap_ptr) + (heap2_ptrend - heap2_ptr));
106-
107105
if (alloc_size <= sizeof(char6_t))
108106
{
109107
if (tab2 && alloc_size <= sizeof(char2_t))
@@ -330,8 +328,8 @@ void* _vram2_realloc(void* ptr, const size_t size)
330328
}
331329

332330
if ((((size_t)ptr >= (size_t)&tab2[0]) && ((size_t)ptr < (size_t)&tab2[ALLOC2])) ||
333-
(((size_t)ptr >= (size_t)&tab3[0]) && ((size_t)ptr < (size_t)&tab3[ALLOC2])) ||
334-
(((size_t)ptr >= (size_t)&tab6[0]) && ((size_t)ptr < (size_t)&tab6[ALLOC2])))
331+
(((size_t)ptr >= (size_t)&tab3[0]) && ((size_t)ptr < (size_t)&tab3[ALLOC3])) ||
332+
(((size_t)ptr >= (size_t)&tab6[0]) && ((size_t)ptr < (size_t)&tab6[ALLOC6])))
335333
{
336334
// ok
337335
}

0 commit comments

Comments
 (0)