/* * Handle the builtin macros for the math functions is* * To get something that is be somewhat generic assume that * isnan() is a real function and that cast of a NaN type * to double will still be a NaN. */ static NODE * mtisnan(NODE *p) { NODE *q = block(NAME, NIL, NIL, INT, 0, 0); return binhelp(q, cast(ccopy(p), DOUBLE, 0), INT, "isnan"); }
static NODE * builtin_unimp(NODE *f, NODE *a, TWORD rt) { char *n = f->n_sp->sname; if (strncmp("__builtin_", n, 10) == 0) n += 10; return binhelp(f, a, rt, n); }
/* * Return NANs, if reasonable. */ static NODE * builtin_nanx(const struct bitable *bt, NODE *a) { if (a == NULL || a->n_op == CM) { uerror("%s bad argument", bt->name); a = bcon(0); } else if (a->n_op == STRING && *a->n_name == '\0') { a->n_op = FCON; a->n_type = bt->rt; memcpy(&a->n_dcon, nLDOUBLE, sizeof(a->n_dcon)); } else a = binhelp(eve(a), bt->rt, &bt->name[10]); return a; }
/* * Handle the builtin macros for the math functions is* * To get something that is be somewhat generic assume that * isnan() is a real function and that cast of a NaN type * to double will still be a NaN. */ static NODE * mtisnan(NODE *p) { return binhelp(cast(ccopy(p), DOUBLE, 0), INT, "isnan"); }
static NODE * builtin_unimp_f(NODE *f, NODE *a, TWORD rt) { return binhelp(f, a, rt, f->n_sp->sname); }
static NODE * builtin_unimp(const struct bitable *bt, NODE *a) { return binhelp(a, bt->rt, &bt->name[10]); }