Example #1
0
static int get_float64(QEMUFile *f, void *pv, size_t size)
{
    float64 *v = pv;

    *v = make_float64(qemu_get_be64(f));
    return 0;
}
Example #2
0
/* do__negate_float
 *
 * opengl-client.api        type:   (Session, Float) -> Float
 * opengl-client-driver.api type:   (Session, Float) -> Float
 */
static Val   do__negate_float   (Task* task, Val arg)
{

    double            f0 =        *(PTR_CAST(double*, GET_TUPLE_SLOT_AS_VAL( arg, 1)));

    double d = -f0;

    return  make_float64(task, d );
}
Example #3
0
Val   _lib7_Math_exp64   (Task* task,  Val arg)   {
    //================
    //
									    ENTER_MYTHRYL_CALLABLE_C_FN("_lib7_Math_exp64");

    double  d  =  *(PTR_CAST(double*, arg));

    return  make_float64(task, exp(d) );
}
Example #4
0
int xtensa_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
{
    XtensaCPU *cpu = XTENSA_CPU(cs);
    CPUXtensaState *env = &cpu->env;
    uint32_t tmp;
    const XtensaGdbReg *reg = env->config->gdb_regmap.reg + n;

    if (n < 0 || n >= env->config->gdb_regmap.num_regs) {
        return 0;
    }

    tmp = ldl_p(mem_buf);

    switch (reg->type) {
    case 9: /*pc*/
        env->pc = tmp;
        break;

    case 1: /*ar*/
        env->phys_regs[(reg->targno & 0xff) % env->config->nareg] = tmp;
        xtensa_sync_window_from_phys(env);
        break;

    case 2: /*SR*/
        env->sregs[reg->targno & 0xff] = tmp;
        break;

    case 3: /*UR*/
        env->uregs[reg->targno & 0xff] = tmp;
        break;

    case 4: /*f*/
        switch (reg->size) {
        case 4:
            env->fregs[reg->targno & 0x0f].f32[FP_F32_LOW] = make_float32(tmp);
            return 4;
        case 8:
            env->fregs[reg->targno & 0x0f].f64 = make_float64(tmp);
            return 8;
        default:
            return 0;
        }

    case 8: /*a*/
        env->regs[reg->targno & 0x0f] = tmp;
        break;

    default:
        qemu_log_mask(LOG_UNIMP, "%s to reg %d of unsupported type %d\n",
                      __func__, n, reg->type);
        return 0;
    }

    return 4;
}
Example #5
0
Val   _lib7_Math_exp64   (Task* task,  Val arg)   {
    //================
    //
									    ENTER_MYTHRYL_CALLABLE_C_FN(__func__);

    double  d  =  *(PTR_CAST(double*, arg));

    Val result =  make_float64(task, exp(d) );
									    EXIT_MYTHRYL_CALLABLE_C_FN(__func__);
    return  result;
}
Example #6
0
static void write_pcm_raw(int32_t *pcm, int count)
{
    if (write_raw) {
        write(output_fd, pcm, count * sizeof(*pcm));
    } else {
        if (!write_header_written)
            write_wav_header();
        int i;
        uint64_t buf[count];

        for (i = 0; i < count; i++)
            buf[i] = htole64(make_float64(pcm[i], format.depth));
        write(output_fd, buf, count * sizeof(*buf));
    }
}
Example #7
0
float64 HELPER(vfp_mulxd)(float64 a, float64 b, void *fpstp)
{
    float_status *fpst = fpstp;

    a = float64_squash_input_denormal(a, fpst);
    b = float64_squash_input_denormal(b, fpst);

    if ((float64_is_zero(a) && float64_is_infinity(b)) ||
        (float64_is_infinity(a) && float64_is_zero(b))) {
        /* 2.0 with the sign bit set to sign(A) XOR sign(B) */
        return make_float64((1ULL << 62) |
                            ((float64_val(a) ^ float64_val(b)) & (1ULL << 63)));
    }
    return float64_mul(a, b, fpst);
}
Example #8
0
// opengl-client.api        type:   (None -- not exported to opengl-client.api level.)
// opengl-client-driver.api type:   Void -> (Int, Float)
//
Val   _lib7_Opengl_get_queued_float_callback   (Task* task, Val arg)  {
    //===================================
    //
    Callback_Queue_Entry e = get_next_queued_callback ();
    //
    if (e.callback_type != QUEUED_FLOAT_CALLBACK) {
        strcpy( text_buf, "get_queued_float_callback: Next callback not Float." );
        moan_and_die();
    }

    double d =  e.entry.float_value;

    Val boxed_double =   make_float64(task, d );					// make_float64		is from   src/c/h/make-strings-and-vectors-etc.h

    set_slot_in_nascent_heapchunk(  task, 0, MAKE_TAGWORD(PAIRS_AND_RECORDS_BTAG, 2));
    set_slot_in_nascent_heapchunk(  task, 1, TAGGED_INT_FROM_C_INT( e.callback_number ));
    set_slot_in_nascent_heapchunk(  task, 2, boxed_double );
    return commit_nascent_heapchunk(task, 2);
}