From 93453ee07c1d870ff0af642b7a11f1ecb8189e19 Mon Sep 17 00:00:00 2001 From: HarlonWang <81813780@qq.com> Date: Thu, 19 Sep 2024 11:56:43 +0800 Subject: [PATCH] Fix compiling with undefined to `bfdec_normalize_and_round` (https://github.com/bellard/quickjs/issues/241) --- libbf.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libbf.c b/libbf.c index 05d62ed..889e3bc 100644 --- a/libbf.c +++ b/libbf.c @@ -3104,11 +3104,14 @@ static int bf_atof_internal(bf_t *r, slimb_t *pexponent, if (exp_is_neg) expn = -expn; } +#ifdef USE_BF_DEC if (is_dec) { a->expn = expn + int_len; a->sign = is_neg; ret = bfdec_normalize_and_round((bfdec_t *)a, prec, flags); - } else if (radix_bits) { + } else +#endif + if (radix_bits) { /* XXX: may overflow */ if (!is_bin_exp) expn *= radix_bits;