aboutsummaryrefslogtreecommitdiff
path: root/tccgen.c
diff options
context:
space:
mode:
Diffstat (limited to 'tccgen.c')
-rw-r--r--tccgen.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/tccgen.c b/tccgen.c
index 6c8faa6..bf171fb 100644
--- a/tccgen.c
+++ b/tccgen.c
@@ -310,6 +310,16 @@ static void vpushll(long long v)
vsetc(&ctype, VT_CONST, &cval);
}
+/* push arbitrary 64bit constant */
+void vpush64(int ty, unsigned long long v)
+{
+ CValue cval;
+ CType ctype;
+ ctype.t = ty;
+ cval.ull = v;
+ vsetc(&ctype, VT_CONST, &cval);
+}
+
/* Return a static symbol pointing to a section */
ST_FUNC Sym *get_sym_ref(CType *type, Section *sec, unsigned long offset, unsigned long size)
{
@@ -3535,6 +3545,21 @@ ST_FUNC void unary(void)
vtop->sym = s;
next();
break;
+
+ // special qnan , snan and infinity values
+ case TOK___NAN__:
+ vpush64(VT_DOUBLE, 0x7ff8000000000000);
+ next();
+ break;
+ case TOK___SNAN__:
+ vpush64(VT_DOUBLE, 0x7ff0000000000001);
+ next();
+ break;
+ case TOK___INF__:
+ vpush64(VT_DOUBLE, 0x7ff0000000000000);
+ next();
+ break;
+
default:
tok_identifier:
t = tok;