From 9e47b182290a2fb3db877e559fef66d29f41ac65 Mon Sep 17 00:00:00 2001 From: Michael Matz Date: Sun, 24 Dec 2017 13:16:09 +0100 Subject: [PATCH] Make type of __nan__ __inf__ and __snan__ be float so that those builtins can be used directly for the C99 NAN and INFINITY math.h macros. --- tccgen.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/tccgen.c b/tccgen.c index e0b744e..c88c537 100644 --- a/tccgen.c +++ b/tccgen.c @@ -5051,17 +5051,18 @@ ST_FUNC void unary(void) } // special qnan , snan and infinity values case TOK___NAN__: - vpush64(VT_DOUBLE, 0x7ff8000000000000ULL); + n = 0x7fc00000; +special_math_val: + vpushi(n); + vtop->type.t = VT_FLOAT; next(); break; case TOK___SNAN__: - vpush64(VT_DOUBLE, 0x7ff0000000000001ULL); - next(); - break; + n = 0x7f800001; + goto special_math_val; case TOK___INF__: - vpush64(VT_DOUBLE, 0x7ff0000000000000ULL); - next(); - break; + n = 0x7f800000; + goto special_math_val; default: tok_identifier: