示例#1
0
def __trunc_sat_u(z, n):
    if math.isnan(z):
        return 0
    if z == -math.inf:
        return 0
    max_value = (uint64(1) << n) - 1
    if math.isinf(z):
        return max_value
    x = math.trunc(z)
    if x < 0:
        return 0
    elif x >= float64(max_value):
        return max_value
    else:
        return uint64(x)
示例#2
0
def i64_trunc_f64u(vm, _):
    f = math.trunc(vm.pop_f64())
    if f >= __MaxUint64 or f < 0:
        raise ErrIntOverflow
    if math.isnan(f):
        raise ErrConvertToInt
    vm.push_u64(uint64(f))
示例#3
0
 def push_u32(self, val):
     self.push_u64(uint64(val))
示例#4
0
def i64_clz(vm, _):
    vm.push_u64(uint64(__leading_zeros64(vm.pop_u64())))
示例#5
0
def i64_extend_i32u(vm, _):
    vm.push_u64(uint64(vm.pop_u32()))
示例#6
0
def i64_pop_cnt(vm, _):
    vm.push_u64(uint64(__ones_count64(vm.pop_u64())))
示例#7
0
def i64_ctz(vm, _):
    vm.push_u64(uint64(__trailing_zeros64(vm.pop_u64())))