def SignedVarintReader(buf, pos=0):
 result = 0
 shift = 0
 while 1:
  b = buf[pos]
  result |= (ORD_MAP_AND_0X7F[b] << shift)
  pos += 1
  if (not ORD_MAP_AND_0X80[b]):
   if (result > 9223372036854775807):
    result -= (1 << 64)
   return (result, pos)
  shift += 7
  if (shift >= 64):
   raise rdfvalue.DecodeError('Too many bytes when decoding varint.')

def SignedVarintReader ( buf , pos = 0 ) : result = 0 shift = 0 while 1 : b = buf [ pos ] result |= ( ORD_MAP_AND_0X7F [ b ] << shift ) pos += 1 if ( not ORD_MAP_AND_0X80 [ b ] ) : if ( result > 9223372036854775807 ) : result -= ( 1 << 64 ) return ( result , pos ) shift += 7 if ( shift >= 64 ) : raise rdfvalue . DecodeError ( 'Too many bytes when decoding varint.' )
a signed 64 bit decoder from google .