#include "vg_platform.h"
#include <stdlib.h>
+#include <malloc.h>
typedef struct vg_linear_allocator vg_linear_allocator;
}
static vg_mem;
-#pragma pack(push,1)
struct vg_linear_allocator
{
u32 size, cur;
void *last_alloc;
u32 last_alloc_size;
};
-#pragma pack(pop)
/*
* TODO: Fallback on libc
- * TODO: 8 byte alignment
*/
VG_STATIC void vg_error(const char *fmt, ...);
__attribute__((warn_unused_result))
VG_STATIC void *vg_linear_alloc( void *allocator, u32 size )
{
+ size += 7;
+ size >>= 3;
+ size <<= 3;
+
if( allocator == NULL )
vg_fatal_exit_loop( "Null allocator" );