Exemplo n.º 1
0
Arquivo: eval.c Projeto: AxFab/nasm
static expr *rexp1(int critical)
{
    expr *e, *f;

    e = rexp2(critical);
    if (!e)
        return NULL;

    while (i == TOKEN_DBL_XOR) {
        i = scan(scpriv, tokval);
        f = rexp2(critical);
        if (!f)
            return NULL;
        if (!(is_simple(e) || is_just_unknown(e)) ||
            !(is_simple(f) || is_just_unknown(f))) {
            nasm_error(ERR_NONFATAL, "`^' operator may only be applied to"
                  " scalar values");
        }

        if (is_just_unknown(e) || is_just_unknown(f))
            e = unknown_expr();
        else
            e = scalarvect((int64_t)(!reloc_value(e) ^ !reloc_value(f)));
    }
    return e;
}
Exemplo n.º 2
0
gsprof *plumgsp(real mtot, real a, int np, real rmin, real rmax)
{
    gsprof *gsp;
    real *rtab, *dtab, *mtab, lgrs;
    int i;

    assert(mtot > 0.0 && a > 0.0);
    gsp = (gsprof *) allocate(sizeof(gsprof));
    rtab = (real *) allocate(np * sizeof(real));
    dtab = (real *) allocate(np * sizeof(real));
    mtab = (real *) allocate(np * sizeof(real));
    lgrs = rlog2(rmax / rmin) / (np - 1);
    for (i = 0; i < np; i++) {
	rtab[i] = rmin * rexp2(lgrs * i);
	dtab[i] = (3 / FOUR_PI) * mtot * a*a /
		    rpow(rsqr(rtab[i]) + a*a, 2.5);
	mtab[i] = mtot * rqbe(rtab[i]) /
		    rpow(rsqr(rtab[i]) + a*a, 1.5);
    }
    gsp->npoint = np;
    gsp->radius = rtab;
    gsp->density = dtab;
    gsp->mass = mtab;
    gsp->alpha = 0.0;
    gsp->beta = -5.0;
    gsp->mtot = mtot;
    return (gsp);
}