decode.py 文件源码

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

项目:fdxread 作者: lkarsten 项目源码 文件源码
def intdecoder(body, width=8, signed=False):
    assert type(body) == BitArray
    assert width % 8 == 0
    assert width in [8, 16]  # for now, due to fmt.
    fmt = "%03i"
    if width == 16:
        fmt = "%05i"

    s = []
    for idx in range(0, body.len, width):
        value = body[idx:idx+width]
        s += [fmt % (value.intle if signed else value.uintle)]
    return [("ints", " ".join(s)), ('strbody', body.hex)]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号