aboutsummaryrefslogtreecommitdiffhomepage
path: root/ast.c
diff options
context:
space:
mode:
Diffstat (limited to 'ast.c')
-rw-r--r--ast.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/ast.c b/ast.c
index 3bcc9c7..e1c9ba6 100644
--- a/ast.c
+++ b/ast.c
@@ -3,6 +3,7 @@ enum TypeKind {
TypeKind_char,
TypeKind_int,
+ TypeKind_short,
TypeKind_long,
TypeKind_void,
TypeKind_ptr,
@@ -70,6 +71,8 @@ int type_sizeof(Type* ty) {
return 8;
} else if (ty->kind == TypeKind_char) {
return 1;
+ } else if (ty->kind == TypeKind_short) {
+ return 2;
} else if (ty->kind == TypeKind_int) {
return 4;
} else if (ty->kind == TypeKind_long) {
@@ -92,6 +95,8 @@ int type_alignof(Type* ty) {
return 8;
} else if (ty->kind == TypeKind_char) {
return 1;
+ } else if (ty->kind == TypeKind_short) {
+ return 2;
} else if (ty->kind == TypeKind_int) {
return 4;
} else if (ty->kind == TypeKind_long) {