diff --git a/driver/ConsecutivePoolAllocator.c b/driver/ConsecutivePoolAllocator.c index ef1ab75..35a710a 100644 --- a/driver/ConsecutivePoolAllocator.c +++ b/driver/ConsecutivePoolAllocator.c @@ -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 diff --git a/driver/PoolAllocator.c b/driver/PoolAllocator.c index ab1a06b..0efdd95 100644 --- a/driver/PoolAllocator.c +++ b/driver/PoolAllocator.c @@ -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