public ulong ReadCompressed(bool canBeLong, ref BitSource source)
        {
            if (source.FreeBits == 0)
            {
                source.MoveToNewByte();
            }

            if (Settings.LazyCompressedWriting)
            {
                return(ReadCompressedLazyFast(canBeLong, ref source));
            }
            else
            {
                return(ReadCompressedSlow(ref source));
            }
        }
        static ulong ReadFirstByteData(ref BitSource source, byte headerLen, byte noContBits, byte preHeaderCapacity)
        {
            bool  isExtended = preHeaderCapacity < 4;
            ulong res        = 0;

            // For an extended first byte (yyy-xxxxxxxx)
            if (isExtended)
            {
                // If there are still "y" bits left, get them.
                if (headerLen < preHeaderCapacity)
                {
                    res = (ulong)source.ReadInteger(source.FreeBits) << noContBits << 8;
                }

                // Make sure we're ready to read "x"s. There will always be "x"es as the header can not physically take them all up.
                if (source.FreeBits == 0)
                {
                    source.MoveToNewByte();
                }
            }

            return(res | ((ulong)source.ReadInteger(source.FreeBits) << noContBits));
        }