about summary refs log tree commit diff
path: root/src/instruction/add.c
blob: 23d4f8c6aa191d730c513a0a379111e8186d8fd3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
#include "3cl.h"

#include "stack.h"
#include "utils.h"

struct CCLFrame *ccl_instruction_add(struct CCL *ccl, struct CCLFrame *frame)
{
    if (ccl->stack.cur < 2)
        die(1, "stack size is %d (%d required)", ccl->stack.cur, 2);
    ccl_stack_push(&ccl->stack, ccl_stack_pop(&ccl->stack) + ccl_stack_pop(&ccl->stack));

    return frame;
}