commit c090b15bd2998ec3d1c51956dcbd3a9dc10e8328
parent e233f10476a51629c1a70b0a16fdc01157059214
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Fri, 1 May 2026 11:25:00 +0200
cc1: Extend cmpnode() to support floats
Diffstat:
1 file changed, 8 insertions(+), 0 deletions(-)
diff --git a/src/cmd/scc-cc/cc1/expr.c b/src/cmd/scc-cc/cc1/expr.c
@@ -50,6 +50,14 @@ cmpnode(Node *np, unsigned long long val)
mask = (val > 1) ? ones(np->type->size) : -1;
nodeval = (tp->prop & TSIGNED) ? sym->u.i : sym->u.u;
return (nodeval & mask) == (val & mask);
+ case FLOAT:
+ if (tp == floattype)
+ return sym->u.f == val;
+ else if (tp == doubletype)
+ return sym->u.d == val;
+ else
+ return sym->u.d == val;
+ break;
default:
abort();
}