MCPcopy Index your code
hub / github.com/pyload/pyload / writeVarint

Function writeVarint

module/lib/thrift/protocol/TCompactProtocol.py:51–60  ·  view source on GitHub ↗
(trans, n)

Source from the content-addressed store, hash-verified

49 return (n >> 1) ^ -(n & 1)
50
51def writeVarint(trans, n):
52 out = []
53 while True:
54 if n & ~0x7f == 0:
55 out.append(n)
56 break
57 else:
58 out.append((n & 0xff) | 0x80)
59 n = n >> 7
60 trans.write(''.join(map(chr, out)))
61
62def readVarint(trans):
63 result = 0

Callers 1

__writeVarintMethod · 0.85

Calls 3

joinMethod · 0.80
appendMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected