• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python jassert.jassert_int函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pyjvm.jassert.jassert_int函数的典型用法代码示例。如果您正苦于以下问题:Python jassert_int函数的具体用法?Python jassert_int怎么用?Python jassert_int使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了jassert_int函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: newarray

def newarray(frame):
    atype = ord(frame.code[frame.pc])
    frame.pc += 1
    count = frame.stack.pop()
    jassert_int(count)
    if count < 0:
        frame.vm.raise_exception(frame, "java/lang/NegativeArraySizeException")
        return
    values = None
    if atype in [10, 5, 8, 9, 4]:  # int, char, byte, short, boolean
        values = [0]*count
    elif atype == 7:  # double
        values = [("double", 0.0)] * count
    elif atype == 6:  # float
        values = [("float", 0.0)] * count
    elif atype == 11:  # long
        values = [("long", 0)] * count
    else:
        raise Exception("Array creation for ATYPE {0} not yet supported"
                        .format(atype))
    prims = {4: "[Z", 5: "[C", 6: "[F", 7: "[D", 8: "[B", 9: "[S",
             10: "[I", 11: "[J"}
    array_class = frame.vm.get_class(prims[atype])
    jarray = JArray(array_class, frame.vm)
    jarray.values = values
    ref = frame.vm.add_to_heap(jarray)
    frame.stack.append(ref)
开发者ID:4toblerone,项目名称:pyjvm,代码行数:27,代码来源:ops_arrays.py


示例2: ireturn

def ireturn(frame):
    value = frame.stack.pop()
    logger.debug("To be returned {0}".format(value))
    jassert_int(value)
    frame.ret = value
    frame.has_result = True
    frame.pc = len(frame.code) + 1
开发者ID:4toblerone,项目名称:pyjvm,代码行数:7,代码来源:ops_ret.py


示例3: i2b

def i2b(frame):
    value = frame.stack.pop()
    jassert_int(value)
    data = struct.pack(">i", value)
    data = data[3]
    result = struct.unpack(">b", data)[0]
    frame.stack.append(result)
开发者ID:4toblerone,项目名称:pyjvm,代码行数:7,代码来源:ops_convert.py


示例4: op_0x60

def op_0x60(frame):  # iadd
    value2 = frame.stack.pop()
    value1 = frame.stack.pop()
    result = value1 + value2
    result = cut_to_int(result)
    jassert_int(result)
    frame.stack.append(result)
开发者ID:googya,项目名称:pyjvm,代码行数:7,代码来源:ops_calc.py


示例5: i2s

def i2s(frame):
    value = frame.stack.pop()
    jassert_int(value)
    data = struct.pack(">i", value)
    data = data[2:]
    result = struct.unpack(">h", data)[0]
    assert type(result) is int
    frame.stack.append(result)
开发者ID:4toblerone,项目名称:pyjvm,代码行数:8,代码来源:ops_convert.py


示例6: l2i

def l2i(frame):
    value = frame.stack.pop()
    jassert_long(value)
    data = struct.pack(">q", value[1])
    data = data[4:]
    result = struct.unpack(">i", data)[0]
    jassert_int(result)
    frame.stack.append(result)
开发者ID:4toblerone,项目名称:pyjvm,代码行数:8,代码来源:ops_convert.py


示例7: op_0x99

def op_0x99(frame):  # if_eq
    byte1 = ord(frame.code[frame.pc])
    byte2 = ord(frame.code[frame.pc + 1])
    frame.pc += 2
    offset = struct.unpack(">h", chr(byte1) + chr(byte2))[0]
    value = frame.stack.pop()
    jassert_int(value)
    if value == 0:
        frame.pc += offset - 2 - 1
开发者ID:googya,项目名称:pyjvm,代码行数:9,代码来源:ops_cond.py


示例8: i2c

def i2c(frame):
    value = frame.stack.pop()
    jassert_int(value)
    data = struct.pack(">i", value)
    data = data[2:]
    result = struct.unpack(">H", data)[0]
    assert type(result) is int
    assert 0 <= result <= int(math.pow(2, 16))
    frame.stack.append(result)
开发者ID:4toblerone,项目名称:pyjvm,代码行数:9,代码来源:ops_convert.py


示例9: lshr

def lshr(frame):
    value2 = frame.stack.pop()
    value1 = frame.stack.pop()
    jassert_int(value2)
    jassert_long(value1)
    value2 &= 0b111111
    result = value1[1] >> value2
    result = ("long", cut_to_long(result))
    jassert_long(result)
    frame.stack.append(result)
开发者ID:4toblerone,项目名称:pyjvm,代码行数:10,代码来源:ops_shift.py


示例10: op_0x79

def op_0x79(frame):  # lshl
    value2 = frame.stack.pop()
    value1 = frame.stack.pop()
    jassert_int(value2)
    jassert_long(value1)
    value2 &= 0b111111
    result = value1[1] << value2
    result = ("long", cut_to_long(result))
    jassert_long(result)
    frame.stack.append(result)
开发者ID:googya,项目名称:pyjvm,代码行数:10,代码来源:ops_shift.py


示例11: op_0xa4

def op_0xa4(frame):  # if_icmple
    byte1 = ord(frame.code[frame.pc])
    byte2 = ord(frame.code[frame.pc + 1])
    frame.pc += 2
    offset = struct.unpack(">h", chr(byte1) + chr(byte2))[0]
    value2 = frame.stack.pop()
    value1 = frame.stack.pop()
    jassert_int(value1)
    jassert_int(value2)
    if value1 <= value2:
        frame.pc += offset - 2 - 1
开发者ID:googya,项目名称:pyjvm,代码行数:11,代码来源:ops_cond.py


示例12: cut_to_int

def cut_to_int(value):
    if -2147483648 <= value <= 2147483647:
        return int(value)
    if value & FLAG32:
        value &= 0xFFFFFFFF
        value ^= 0xFFFFFFFF
        value += 1
        value *= -1
    else:
        value &= 0xFFFFFFFF
    jassert_int(value)
    return int(value)
开发者ID:googya,项目名称:pyjvm,代码行数:12,代码来源:ops_calc.py


示例13: lushr

def lushr(frame):
    value2 = frame.stack.pop()
    value1 = frame.stack.pop()
    jassert_long(value1)
    jassert_int(value2)
    value2 &= 0b111111
    data = struct.pack(">q", value1[1])
    result = struct.unpack(">Q", data)[0]
    result >>= value2
    data = struct.pack(">Q", result)
    result = struct.unpack(">q", data)[0]
    result = ("long", cut_to_long(result))
    jassert_long(result)
    frame.stack.append(result)
开发者ID:4toblerone,项目名称:pyjvm,代码行数:14,代码来源:ops_shift.py


示例14: f2i

def f2i(frame):
    value = frame.stack.pop()
    jassert_float(value)
    if value[1] is None:
        frame.stack.append(0)
    else:
        if value[1] < -2147483648:  # -1 * math.pow(2, 31)
            result = -2147483648
        elif value[1] > 2147483647:  # math.pow(2, 31) - 1
            result = 2147483647
        else:
            result = int(value[1])
        jassert_int(result)
        frame.stack.append(result)
开发者ID:4toblerone,项目名称:pyjvm,代码行数:14,代码来源:ops_convert.py


示例15: op_0x8e

def op_0x8e(frame):  # d2i
    value = frame.stack.pop()
    jassert_double(value)
    if value[1] is None:
        frame.stack.append(0)
    else:
        if value[1] < -2147483648:  # -1 * math.pow(2, 31)
            result = -2147483648
        elif value[1] > 2147483647:  # math.pow(2, 31) - 1
            result = 2147483647
        else:
            result = int(value[1])
        jassert_int(result)
        frame.stack.append(result)
开发者ID:googya,项目名称:pyjvm,代码行数:14,代码来源:ops_convert.py


示例16: aaload

def aaload(frame):
    index = frame.stack.pop()
    ref = frame.stack.pop()
    jassert_int(index)
    if ref is None:
        frame.vm.raise_exception(frame, "java/lang/NullPointerException")
        return
    jassert_ref(ref)
    array = frame.vm.heap[ref[1]]
    values = array.values
    if index < 0 or index >= len(values):
        frame.vm.raise_exception(frame,
                                 "java/lang/ArrayIndexOutOfBoundsException")
        return
    frame.stack.append(values[index])
开发者ID:4toblerone,项目名称:pyjvm,代码行数:15,代码来源:ops_arrays.py


示例17: sastore

def sastore(frame):
    value = frame.stack.pop()
    index = frame.stack.pop()
    ref = frame.stack.pop()
    jassert_int(value)
    jassert_int(index)
    if ref is None:
        frame.vm.raise_exception(frame, "java/lang/NullPointerException")
        return
    jassert_ref(ref)
    array = frame.vm.heap[ref[1]]
    jassert_array(array)
    values = array.values
    if index < 0 or index >= len(values):
        frame.vm.raise_exception(frame,
                                 "java/lang/ArrayIndexOutOfBoundsException")
        return
    values[index] = value
开发者ID:4toblerone,项目名称:pyjvm,代码行数:18,代码来源:ops_arrays.py


示例18: anewarray

def anewarray(frame):
    index = (ord(frame.code[frame.pc]) << 8) + ord(frame.code[frame.pc + 1])
    frame.pc += 2
    cp_item = frame.this_class.constant_pool[index]
    assert cp_item[0] == 7  # CONSTANT_Class
    klass_name = frame.this_class.constant_pool[cp_item[1]][1]
    assert type(klass_name) is unicode
    frame.vm.get_class(klass_name)  # make sure it is loaded

    count = frame.stack.pop()
    jassert_int(count)
    if count < 0:
        frame.vm.raise_exception(frame, "java/lang/NegativeArraySizeException")
        return

    values = [None] * count
    array_class = frame.vm.get_class("[L" + klass_name + ";")
    jarray = JArray(array_class, frame.vm)
    jarray.values = values
    ref = frame.vm.add_to_heap(jarray)
    frame.stack.append(ref)
开发者ID:4toblerone,项目名称:pyjvm,代码行数:21,代码来源:ops_arrays.py


示例19: op_0xaa

def op_0xaa(frame):  # tableswitch
    index = frame.stack.pop()
    jassert_int(index)
    last_pc = frame.pc - 1
    while frame.pc % 4 != 0:
        frame.pc += 1
    default = struct.unpack(">i", frame.code[frame.pc:frame.pc + 4])[0]
    frame.pc += 4
    low = struct.unpack(">i", frame.code[frame.pc:frame.pc + 4])[0]
    frame.pc += 4
    high = struct.unpack(">i", frame.code[frame.pc:frame.pc + 4])[0]
    frame.pc += 4
    if index < low or index > high:
        frame.pc = last_pc + default
        return
    count = high - low + 1
    offsets = []
    for i in range(count):
        offsets.append(struct.unpack(">i",
                                     frame.code[frame.pc:frame.pc + 4])[0])
        frame.pc += 4
    frame.pc = last_pc + offsets[index - low]
开发者ID:googya,项目名称:pyjvm,代码行数:22,代码来源:ops_cond.py


示例20: op_0x80

def op_0x80(frame):  # ior
    value2 = frame.stack.pop()
    value1 = frame.stack.pop()
    jassert_int(value2)
    jassert_int(value1)
    result = value1 | value2
    result = cut_to_int(result)
    jassert_int(result)
    frame.stack.append(result)
开发者ID:googya,项目名称:pyjvm,代码行数:9,代码来源:ops_shift.py



注:本文中的pyjvm.jassert.jassert_int函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python simpleconsumer.OwnedPartition类代码示例发布时间:2022-05-25
下一篇:
Python jenkins.Jenkins类代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap