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

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

struct CCLFrame *ccl_instruction_subtract(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;
}