align the buffer

This commit is contained in:
Milang 2019-08-17 18:23:41 +02:00
parent 6f36dd1966
commit bfe73f1886
1 changed files with 14 additions and 0 deletions

View File

@ -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)