class CompressedInt64Serializer (Niantic.ARDK.Utilities.BinarySerialization.ItemSerializers.CompressedInt64Serializer)
Overview
class CompressedInt64Serializer: Niantic.ARDK.Utilities.BinarySerialization.ItemSerializers.BaseItemSerializer { public: // fields static readonly CompressedInt64Serializer Instance = new CompressedInt64Serializer(); // methods static Int64 ReadCompressedInt64(Stream stream); static void WriteCompressedInt64(Stream stream, Int64 value); };
Inherited Members
public: // properties Type DataType; // methods object Deserialize(BinaryDeserializer deserializer); T Deserialize(BinaryDeserializer deserializer); void Serialize(BinarySerializer serializer, object item); void Serialize(BinarySerializer serializer, T item); T Deserialize(BinaryDeserializer deserializer); void Serialize(BinarySerializer serializer, T item);
Detailed Documentation
Methods
static void WriteCompressedInt64(Stream stream, Int64 value)
Writes an Int64 value in “compressed” format. This uses the UInt64 compression logic, with an extra twist. -1 has all bytes set, meaning that if we just want to use the “compression” on it, it will occupy 10 bytes. So, instead, we shift the sign bit to the right and invert all the bits when a value is negative. In this way, the values 0, -1, 1, -2, 2, -3, 3 etc are actually written as 0, 1, 2, 3, 4, 5, 6, keeping just one byte instead of 4 (no compression) or 10 (bad compression for negatives).