예제 #1
0
def i64_trunc_f64s(vm, _):
    f = math.trunc(vm.pop_f64())
    if f >= __MaxInt64 or f < __MinInt64:
        raise ErrIntOverflow
    if math.isnan(f):
        raise ErrConvertToInt
    vm.push_s64(int64(f))
예제 #2
0
def __trunc_sat_s(z, n):
    if math.isnan(z):
        return 0
    min_value = -(int64(1) << (n - 1))
    max_value = (int64(1) << (n - 1)) - 1
    if z == -math.inf:
        return min_value
    if math.isinf(z):
        return max_value
    x = math.trunc(z)
    if x < float64(min_value):
        return min_value
    elif x >= float64(max_value):
        return max_value
    else:
        return int64(x)
예제 #3
0
def i64_load_32s(vm, mem_arg):
    val = read_u32(vm, mem_arg)
    vm.push_s64(int64(int32(val)))
예제 #4
0
def i64_load_16s(vm, mem_arg):
    val = read_u16(vm, mem_arg)
    vm.push_s64(int64(int16(val)))
예제 #5
0
def i64_load_8s(vm, mem_arg):
    val = read_u8(vm, mem_arg)
    vm.push_s64(int64(int8(val)))
예제 #6
0
def i64_const(vm, args):
    vm.push_s64(int64(args))
예제 #7
0
def i64_extend_32s(vm, _):
    vm.push_s64(int64(int32(vm.pop_s64())))
예제 #8
0
def i64_extend_16s(vm, _):
    vm.push_s64(int64(int16(vm.pop_s64())))
예제 #9
0
def i64_extend_8s(vm, _):
    vm.push_s64(int64(int8(vm.pop_s64())))
예제 #10
0
def i64_extend_i32s(vm, _):
    vm.push_s64(int64(vm.pop_s32()))
예제 #11
0
 def pop_s64(self) -> int64:
     return int64(self.pop_numeric())