Exemple #1
0
def wrap_u64(vt, val):
    if vt == ValTypeI32:
        return int32(val)
    elif vt == ValTypeI64:
        return int64(val)
    elif vt == ValTypeF32:
        val = struct.unpack('>f', struct.pack('>l', int64(val)))[0]
        return float32(val)
    elif vt == ValTypeF64:
        val = struct.unpack('>d', struct.pack('>q', int64(val)))[0]
        return float64(val)
    else:
        raise Exception("unreachable")
Exemple #2
0
def f32_demote_f64(vm, _):
    vm.push_f32(float32(vm.pop_f64()))
Exemple #3
0
def f32_const(vm, args):
    vm.push_f32(float32(args))
Exemple #4
0
def f32_convert_i64u(vm, _):
    vm.push_f32(float32(vm.pop_u64()))
Exemple #5
0
def f32_convert_i64s(vm, _):
    vm.push_f32(float32(vm.pop_s64()))
Exemple #6
0
def f32_convert_i32u(vm, _):
    vm.push_f32(float32(vm.pop_u32()))
Exemple #7
0
def f32_convert_i32s(vm, _):
    vm.push_f32(float32(vm.pop_s32()))
Exemple #8
0
 def pop_f32(self):
     val = self.pop_numeric()
     val = struct.unpack('>f', struct.pack('>l', val))[0]
     return float32(val)