datagen.py 文件源码

python
阅读 33 收藏 0 点赞 0 评论 0

项目:abe-bootstrap 作者: TryCoin-Team 项目源码 文件源码
def op(gen, d):
        if isinstance(d, int):
            if d == 0:
                return opcodes.OP_0
            if d == -1 or 1 <= d <= 16:
                return d + opcodes.OP_1 - 1
            # Hmm, maybe time to switch to Python 3 with int.from_bytes?
            h = "00%x" % (d if d >= 0 else -1-d)
            if len(h) % 2:
                h = h[1:]
            elif h[2] < '8':
                h = h[2:]
            if d < 0:
                import string
                h = h.translate(string.maketrans('0123456789abcdef', 'fedcba9876543210'))
            return h.decode('hex')
        raise ValueError(n)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号