def AppendSInt64(self, field_number, value): """Appends a 64-bit integer to our buffer, zigzag-encoded and then varint-encoded. """ self._AppendTag(field_number, wire_format.WIRETYPE_VARINT) zigzag_value = wire_format.ZigZagEncode(value) self._stream.AppendVarUInt64(zigzag_value)
def encode_svarint(value): """Zigzag encode the potentially signed value prior to encoding""" # zigzag encode value return encode_uvarint(wire_format.ZigZagEncode(value))
def _encode_signed_varint(cls, value): value = protobuf_wire_format.ZigZagEncode(value) data = [] _SignedVarintEncoder(data.append, value) return b''.join(data)
def AppendSInt64NoTag(self, value): """Appends a 64-bit integer to our buffer, zigzag-encoded and then varint-encoded. """ zigzag_value = wire_format.ZigZagEncode(value) self._stream.AppendVarUInt64(zigzag_value)
def write_long_no_tag(self, val): _EncodeVarint(self._write, wire_format.ZigZagEncode(val))