Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compiling with undefined to bfdec_normalize_and_round #354

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

HarlonWang
Copy link

@HarlonWang HarlonWang commented Sep 19, 2024

A compilation error occurs when without CONFIG_BIGNUM.

quickjs/libbf.c:3110: error: undefined reference to 'bfdec_normalize_and_round'

Because there's no conditional handling here.

/* enable it to check the multiplication result */
//#define USE_MUL_CHECK
#ifdef CONFIG_BIGNUM
/* enable it to use FFT/NTT multiplication */
#define USE_FFT_MUL
/* enable decimal floating point support */
#define USE_BF_DEC
#endif

static int bf_atof_internal(...){
    if (is_dec) {
        a->expn = expn + int_len;
        a->sign = is_neg;
        // we need to check if USE_BF_DEC is enabled.
        ret = bfdec_normalize_and_round((bfdec_t *)a, prec, flags);
    } else if (radix_bits) {
        ...
    }
   ...

I made a simple fix.

#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
#endif
    if (radix_bits) {

Related issues:
#241
#326

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant