commit f99d1fb0d06de8ead375c15efe7a5b3f8659ee17 parent a634fa00333eff9cb10a14718b0ebcaa41bdea3b Author: Michael Savage <mikejsavage@gmail.com> Date: Wed Oct 12 19:50:11 +0300 Add memarena_push_array Diffstat:
memory_arena.h | | | 4 | ++++ |
diff --git a/memory_arena.h b/memory_arena.h @@ -2,6 +2,7 @@ #define _MEMORY_ARENA_H_ #include "intrinsics.h" +#include "array.h" struct MemoryArena { u8 * memory; @@ -30,6 +31,9 @@ u8 * memarena_push_size( MemoryArena * const arena, const size_t size, const upt #define memarena_push_type( arena, type, ... ) ( ( type * ) memarena_push_size( arena, sizeof( type ), ##__VA_ARGS__ ) ) #define memarena_push_many( arena, type, count, ... ) ( ( type * ) memarena_push_size( arena, sizeof( type ) * count, ##__VA_ARGS__ ) ) +#define memarena_push_array( arena, type, count, ... ) \ + array< type >( ( ( type * ) memarena_push_size( arena, sizeof( type ) * count, ##__VA_ARGS__ ) ), sizeof( type ) * count ) + MemoryArena memarena_push_arena( MemoryArena * const arena, const size_t size ); void memarena_clear( MemoryArena * const arena );