commit dd0e1327e91cc492516ad7b8f2c9284f011a5714
parent 907597bddc77066eaf8b624fba10a309d8c34750
Author: William Casarin <jb55@jb55.com>
Date: Sun, 12 Nov 2017 15:07:09 -0800
alloc: num_pool_pop
Diffstat:
2 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/alloc.c b/alloc.c
@@ -31,6 +31,13 @@ num_pool_get(const int ind) {
struct num *
+num_pool_pop() {
+ assert(g_arenas.num_count > 0);
+ return &g_arenas.nums[g_arenas.num_count--];
+}
+
+
+struct num *
num_pool_new(int *ind) {
*ind = g_arenas.num_count++;
struct num *p;
diff --git a/alloc.h b/alloc.h
@@ -11,6 +11,7 @@
#define ALLOC_PUSHDATA_BYTES (MAX_STACK_SIZE * MAX_OPS_PER_SCRIPT)
struct num * num_pool_new(int *ind);
+struct num * num_pool_pop();
struct num * num_pool_get(const int ind);
u8 *byte_pool_new(const u16 len, u16 *ind);