encoder.py 文件源码

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

项目:deoplete-asm 作者: zchee 项目源码 文件源码
def _SignedVarintEncoder():
  """Return an encoder for a basic signed varint value (does not include
  tag)."""

  def EncodeSignedVarint(write, value):
    if value < 0:
      value += (1 << 64)
    bits = value & 0x7f
    value >>= 7
    while value:
      write(six.int2byte(0x80|bits))
      bits = value & 0x7f
      value >>= 7
    return write(six.int2byte(bits))

  return EncodeSignedVarint
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号