From 1b406b13b03055d2b2d08e8279a4a80c41ca7c20 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 3 May 2026 16:46:10 +0900 Subject: fix: div/mod/shift operations on unsigned integers --- src/ast.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/ast.c') diff --git a/src/ast.c b/src/ast.c index 4d30a66..0dcec0d 100644 --- a/src/ast.c +++ b/src/ast.c @@ -126,6 +126,11 @@ bool type_is_unsized(Type* ty) { return ty->kind == TypeKind_void; } +bool type_is_unsigned(Type* ty) { + return ty->kind == TypeKind_uchar || ty->kind == TypeKind_ushort || ty->kind == TypeKind_uint || + ty->kind == TypeKind_ulong || ty->kind == TypeKind_ullong || ty->kind == TypeKind_bool; +} + int type_sizeof(Type* ty) { if (type_is_unsized(ty)) { fatal_error("type_sizeof: type size cannot be determined"); -- cgit v1.3.1