dabd90569f9a0e19c7d018fe8bd83da5063fb475
[fur] / templates / comparison_instruction.c
1 void {{ name }}(struct Thread* thread, const union Argument argument) {
2   // We're going to reuse result as both the first input and the result
3   assert(!Stack_isEmpty(&(thread->stack)));
4   Object result = Stack_pop(&(thread->stack));
5   assert(result.type == INTEGER);
6
7   assert(!Stack_isEmpty(&(thread->stack)));
8   Object other = Stack_pop(&(thread->stack));
9   assert(other.type == INTEGER);
10
11   result.type = BOOLEAN;
12   result.value.boolean = other.value.integer {{ operation }} result.value.integer;
13
14   Stack_push(&(thread->stack), result);
15 }