guidpacker
public text v1 · immutablepublic byte[] GetPackedGUID(ulong guid)
{
byte[] guidBytes = BitConverter.GetBytes(guid);
List<byte> packedGUID = new List<byte>();
packedGUID.Add(0); // mask
for (int i = 0; i < 8; i++)
{
if (guidBytes[i] != 0)
{
packedGUID[0] |= (byte)(1 << i);
packedGUID.Add(guidBytes[i]);
}
}
return packedGUID.ToArray();
}