aboutsummaryrefslogtreecommitdiffstats
path: root/src/bytecode/darray.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/bytecode/darray.h')
-rwxr-xr-xsrc/bytecode/darray.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/bytecode/darray.h b/src/bytecode/darray.h
index db6234d..e8cdc36 100755
--- a/src/bytecode/darray.h
+++ b/src/bytecode/darray.h
@@ -25,6 +25,9 @@ typedef struct ArrayHeader {
25// Return the last element of the array. Can be used to build stacks. 25// Return the last element of the array. Can be used to build stacks.
26#define array_pop(ARR) (ARR)[--array_head(ARR)->size] 26#define array_pop(ARR) (ARR)[--array_head(ARR)->size]
27 27
28// Return the value stored at the OFFSET position from the tail of the array.
29#define array_peek(ARR, OFFSET) (ARR)[array_head(ARR)->size - 1 - (OFFSET)]
30
28// Insert N bytes from the SRC array into the ARR dynamic array. 31// Insert N bytes from the SRC array into the ARR dynamic array.
29#define array_insert(ARR, SRC, N) \ 32#define array_insert(ARR, SRC, N) \
30 ((ARR) = _array_insert(ARR, SRC, N, sizeof(*(ARR)))) 33 ((ARR) = _array_insert(ARR, SRC, N, sizeof(*(ARR))))