aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/c_type.h
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2026-04-13 19:25:11 +0200
committerlemon <lsof@mailbox.org>2026-04-13 19:30:01 +0200
commitddbd42e66cc71b470730037d76f4f267e98d8d40 (patch)
treeaae9ff541b3e0690e23e391bb2e5e8927d34bf38 /src/c_type.h
parent36143af2748b6fcae02ca320baaac417d77ebe58 (diff)
C99 complex types MVP
Missing: static eval of complex values, Silly inefficient implementation of equality comparisons between them The whole thing is pretty inefficient without proper aggregate mem2reg anyway
Diffstat (limited to 'src/c_type.h')
-rw-r--r--src/c_type.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/c_type.h b/src/c_type.h
index 6ef1bc3..1347fcc 100644
--- a/src/c_type.h
+++ b/src/c_type.h
@@ -137,10 +137,12 @@ Type typedecay(Type);
bool assigncompat(Type dst, Type src);
enum typetag intpromote(enum typetag);
Type cvtarith(Type a, Type b);
+Type complex2struct(Type);
static inline Type
typechild(Type t)
{
if (t.t == TYENUM) return mktype(typedata[t.dat].backing);
+ if (iscomplex(t)) return mktype(t.t - TYCOMPLEXF + TYFLOAT);
if (t.flag & TFCHLDPRIM) return mktype(t.child);
if (t.flag & TFCHLDISDAT) {
Type chld = mktype(typedata[t.dat].t, .flag = typedata[t.dat].flag, .dat = t.dat);