Beispiel #1
0
 def EncodeVarint(write, value):
     bits = value & 0x7f
     value >>= 7
     while value:
         write(bytestr(0x80 | bits))
         bits = value & 0x7f
         value >>= 7
     return write(bytestr(bits))
Beispiel #2
0
 def EncodeVarint(write, value):
   bits = value & 0x7f
   value >>= 7
   while value:
     write(bytestr(0x80|bits))
     bits = value & 0x7f
     value >>= 7
   return write(bytestr(bits))
Beispiel #3
0
 def EncodeSignedVarint(write, value):
     if value < 0:
         value += (1 << 64)
     bits = value & 0x7f
     value >>= 7
     while value:
         write(bytestr(0x80 | bits))
         bits = value & 0x7f
         value >>= 7
     return write(bytestr(bits))
Beispiel #4
0
 def EncodeSignedVarint(write, value):
   if value < 0:
     value += (1 << 64)
   bits = value & 0x7f
   value >>= 7
   while value:
     write(bytestr(0x80|bits))
     bits = value & 0x7f
     value >>= 7
   return write(bytestr(bits))