diff options
| author | nsfisis <nsfisis@gmail.com> | 2025-08-03 13:19:40 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2025-08-15 10:06:21 +0900 |
| commit | e1de8fc36f11ac932707c7113eb4bf3ebc4b1f74 (patch) | |
| tree | 65c0a362dc9343b09a6e452d5526e39da834b986 /ast.c | |
| parent | 185778aa3ae35252ae992f12a9dfc39a4eab5758 (diff) | |
| download | ducc-e1de8fc36f11ac932707c7113eb4bf3ebc4b1f74.tar.gz ducc-e1de8fc36f11ac932707c7113eb4bf3ebc4b1f74.tar.zst ducc-e1de8fc36f11ac932707c7113eb4bf3ebc4b1f74.zip | |
feat: support short type
Diffstat (limited to 'ast.c')
| -rw-r--r-- | ast.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -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) { |
