align the buffer
This commit is contained in:
parent
6f36dd1966
commit
bfe73f1886
|
@ -26,6 +26,20 @@ static const uint32_t size_char = size_uint32*sizeof(int32_t);
|
|||
static int32_t* address=0;
|
||||
|
||||
const int32_t clearval=3000;
|
||||
|
||||
#define ALIGN 4
|
||||
static void* buffer_malloc(uint32_t size)
|
||||
{
|
||||
void *mem = malloc(size+ALIGN+sizeof(void*));
|
||||
void **ptr = (void**)((uintptr_t)(mem+ALIGN+sizeof(void*)) & ~(ALIGN-1));
|
||||
ptr[-1] = mem;
|
||||
return ptr;
|
||||
}
|
||||
void aligned_free(void *ptr)
|
||||
{
|
||||
free(((void**)ptr)[-1]);
|
||||
}
|
||||
|
||||
void FE_zbuffer_clear()
|
||||
{
|
||||
if (address==0)
|
||||
|
|
Loading…
Reference in New Issue