attempt converting these to uintptr_t

This commit is contained in:
DarthArgus
2014-11-04 14:28:16 -08:00
parent 22c6d8816f
commit 737ca0ccb5
2 changed files with 7 additions and 7 deletions
+1 -1
View File
@@ -20,7 +20,7 @@ namespace Base
void returnBlock(unsigned *handle);
private:
unsigned *m_blocks[31];
uintptr_t *m_blocks[31];
};
};
#ifdef EXTERNAL_DISTRO
@@ -23,8 +23,8 @@ namespace Base
{
while(m_blocks[i] != NULL)
{
unsigned *tmp = m_blocks[i];
m_blocks[i] = (unsigned *)*m_blocks[i];
uintptr_t *tmp = m_blocks[i];
m_blocks[i] = (uintptr_t *)*m_blocks[i];
free(tmp);
}
}
@@ -36,7 +36,7 @@ namespace Base
void *BlockAllocator::getBlock(unsigned bytes)
{
unsigned accum = 16, bits = 16;
unsigned *handle = NULL;
uintptr_t *handle = NULL;
// Perform a binary search looking for the highest bit.
@@ -79,7 +79,7 @@ namespace Base
if(m_blocks[accum] == 0)
{
// remove the pre allocated block from the linked list
handle = (unsigned *)calloc(((1 << accum) / 4) + 2, sizeof(unsigned));
handle = (uintptr_t *)calloc(((1 << accum) / 4) + 2, sizeof(unsigned));
handle[1] = accum;
handle[0] = 0;
}
@@ -87,7 +87,7 @@ namespace Base
{
// Allocate a new block
handle = m_blocks[accum];
m_blocks[accum] = (unsigned *)handle[0];
m_blocks[accum] = (uintptr_t *)handle[0];
handle[0] = 0;
}
// return a pointer that skips over the header used for the allocator's purposes
@@ -100,7 +100,7 @@ namespace Base
if(handle)
{
// Update the allocator linked list, insert this entry at the head
*(handle - 2) = (unsigned)m_blocks[*(handle - 1)];
*(handle - 2) = (uintptr_t)m_blocks[*(handle - 1)];
// Add this entry to the proper linked list node
m_blocks[*(handle - 1)] = (handle - 2);
}