Add basic comp ops implementations
This commit is contained in:
parent
6d7de03ae8
commit
9d438d7347
28
include/ops.h
Normal file
28
include/ops.h
Normal file
@ -0,0 +1,28 @@
|
||||
#ifndef COMP_OPS_H
|
||||
#define COMP_OPS_H
|
||||
|
||||
#include "aliases/aliases.h"
|
||||
#include "nodes.h"
|
||||
|
||||
enum comp_ops {
|
||||
COMP_OP_ADD,
|
||||
COMP_OP_SUB,
|
||||
COMP_OP_MUL,
|
||||
COMP_OP_DIV,
|
||||
|
||||
COUNT_COMP_OPS,
|
||||
};
|
||||
|
||||
i32 comp_add(i32 a, i32 b);
|
||||
i32 comp_sub(i32 a, i32 b);
|
||||
i32 comp_mul(i32 a, i32 b);
|
||||
i32 comp_div(i32 a, i32 b);
|
||||
|
||||
INTERNAL node_func_t ops[COUNT_COMP_OPS] = {
|
||||
[COMP_OP_ADD] = comp_add,
|
||||
[COMP_OP_SUB] = comp_sub,
|
||||
[COMP_OP_MUL] = comp_mul,
|
||||
[COMP_OP_DIV] = comp_div,
|
||||
};
|
||||
|
||||
#endif // !COMP_OPS_H
|
10
src/ops.c
Normal file
10
src/ops.c
Normal file
@ -0,0 +1,10 @@
|
||||
#include "ops.h"
|
||||
#include "aliases/aliases.h"
|
||||
|
||||
i32 comp_add(i32 a, i32 b) { return a + b; }
|
||||
|
||||
i32 comp_sub(i32 a, i32 b) { return a - b; }
|
||||
|
||||
i32 comp_mul(i32 a, i32 b) { return a * b; }
|
||||
|
||||
i32 comp_div(i32 a, i32 b) { return a / b; }
|
Loading…
x
Reference in New Issue
Block a user