diff options
| author | 2025-10-15 11:18:47 +0200 | |
|---|---|---|
| committer | 2025-10-15 11:18:47 +0200 | |
| commit | 41483dda42f6eb2ce45b0f8580fc46eacf6390b8 (patch) | |
| tree | b804c23ae9f3539234a2d384f991c898760975cb /common.h | |
| parent | 347d237a114495c0a9b9d14d38551d544dca021d (diff) | |
c: fix codegen for enum types
Diffstat (limited to 'common.h')
| -rw-r--r-- | common.h | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -203,8 +203,8 @@ union type { #define isaggt(t) in_range((t), TYSTRUCT, TYUNION) #define isprim(ty) isprimt((ty).t) #define isint(ty) isintt((ty).t) -#define issigned(ty) issignedt((ty).t) -#define isunsigned(ty) isunsignedt((ty).t) +#define issigned(ty) issignedt(scalartypet(ty)) +#define isunsigned(ty) isunsignedt(scalartypet(ty)) #define isflt(ty) isfltt((ty).t) #define isarith(ty) isaritht((ty).t) #define isscalar(ty) isscalart((ty).t) @@ -317,6 +317,11 @@ typechild(union type t) } return typedata[t.dat].child; } +static inline enum typetag +scalartypet(union type t) +{ + return t.t == TYENUM ? t.backing : t.t; +} static inline uint typearrlen(union type t) { |