Public feed #380323

Untitled

public text v1 · immutable
Raw Edit
·published 2007-03-03 23:46 UTC
rendered paste body
public class GUID
    {
        private ulong m_rawGuid;
        public GUID(ulong rawGuid)
        {
            m_rawGuid = rawGuid;
        }

        public byte[] GetPacked()
        {
            byte[] guidBytes = BitConverter.GetBytes(m_rawGuid);
            List<byte> packedGUID = new List<byte>();
            packedGUID.Add(0);
            for (int i = 0; i < 8; i++)
            {
                if (guidBytes[i] != 0)
                {
                    packedGUID[0] |= (byte)(1 << i);
                    packedGUID.Add(guidBytes[i]);
                }
            }
            return packedGUID.ToArray();
        }
    }