parameters: (mask, result_type)
return_statement: return DecodeVarint
docstring: Like _VarintDecoder() but decodes signed values.
docstring_summary: Like _VarintDecoder() but decodes signed values.
docstring_tokens: Like _VarintDecoder () but decodes signed values .
function: def _SignedVarintDecoder(mask, result_type):
    """Like _VarintDecoder() but decodes signed values."""
  
    local_ord = ord
    py2 = _PY2  ##PY25
  ##!PY25  py2 = str is bytes
    def DecodeVarint(buffer, pos):
      result = 0
      shift = 0
      while 1:
        b = local_ord(buffer[pos]) if py2 else buffer[pos]
        result |= ((b & 0x7f) << shift)
        pos += 1
        if not (b & 0x80):
          if result > 0x7fffffffffffffff:
            result -= (1 << 64)
            result |= ~mask
          else:
            result &= mask
          result = result_type(result)
          return (result, pos)
        shift += 7
        if shift >= 64:
          raise _DecodeError('Too many bytes when decoding varint.')
    return DecodeVarint
function_tokens: def _SignedVarintDecoder ( mask , result_type ) : local_ord = ord py2 = _PY2 ##PY25 ##!PY25  py2 = str is bytes def DecodeVarint ( buffer , pos ) : result = 0 shift = 0 while 1 : b = local_ord ( buffer [ pos ] ) if py2 else buffer [ pos ] result |= ( ( b & 0x7f ) << shift ) pos += 1 if not ( b & 0x80 ) : if result > 0x7fffffffffffffff : result -= ( 1 << 64 ) result |= ~ mask else : result &= mask result = result_type ( result ) return ( result , pos ) shift += 7 if shift >= 64 : raise _DecodeError ( 'Too many bytes when decoding varint.' ) return DecodeVarint