From 6a9be3885f211286963d7af8d2b3044b2d73c483 Mon Sep 17 00:00:00 2001 From: q66 Date: Wed, 17 Aug 2016 17:10:55 +0100 Subject: [PATCH] simplify float parsing --- cs_util.cc | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/cs_util.cc b/cs_util.cc index 20a4e08..dc4dff1 100644 --- a/cs_util.cc +++ b/cs_util.cc @@ -141,17 +141,13 @@ static inline bool parse_gen_float( if (!wn && !fn) { return false; } - if (Hex) { - fn *= -4; - } else { - fn = -fn; - } + fn = -fn; p_set_end(input, end); /* we have a valid number until here */ if (p_read_exp(input, fn)) { p_set_end(input, end); } if (Hex) { - ret = CsFloat(ldexp(r, fn)); + ret = CsFloat(ldexp(r, fn * 4)); } else { ret = CsFloat(r * pow(10, fn)); }