1
0
mirror of https://github.com/Yours3lf/rpi-vk-driver.git synced 2025-03-21 12:29:15 +01:00

fixed pool allocator whoops

This commit is contained in:
Unknown 2018-09-29 15:59:17 +01:00
parent 81ac862990
commit 9f3d3de52f
2 changed files with 6 additions and 5 deletions

View File

@ -24,8 +24,8 @@ ConsecutivePoolAllocator createConsecutivePoolAllocator(char* b, unsigned bs, un
unsigned last = s/bs - 1;
for(unsigned c = 0; c < last; ++c)
{
*ptr = (uint32_t)ptr + bs;
ptr += bs/4;
*ptr = (char*)ptr + bs;
ptr = (char*)ptr + bs;
}
*ptr = 0; //last element

View File

@ -21,10 +21,11 @@ PoolAllocator createPoolAllocator(char* b, unsigned bs, unsigned s)
//initialize linked list of free pointers
uint32_t* ptr = pa.nextFreeBlock;
for(unsigned c = 0; c < s/bs - 1; ++c)
unsigned last = s/bs - 1;
for(unsigned c = 0; c < last; ++c)
{
*ptr = (uint32_t)ptr + bs;
ptr += bs;
*ptr = (char*)ptr + bs;
ptr = (char*)ptr + bs;
}
*ptr = 0; //last element