getTokenDis() public static méthode

Get a match token according to the match distance.
public static getTokenDis ( int distance ) : Token
distance int The distance here means the needed bytes backward.
Résultat Token
Exemple #1
0
        /// <summary>
        /// Add the a match to the result bit buffer.
        /// </summary>
        /// <param name="distance">The number of bytes backward to copy from.</param>
        /// <param name="length">The total number of bytes to be copied.</param>
        private void addCompressBytes(int distance, int length)
        {
            Token token = Config.getTokenDis(distance);

            bitBuffer.AddRange(convertStringToBits(token.BitPrefix));
            bitBuffer.AddRange(convertIntToBits(distance - token.Vbase, token.ValueBits));
            int exp = 1;

            while (length >= Math.Pow(2, exp))
            {
                ++exp;
            }
            token = Config.getTokenLen(length);
            bitBuffer.AddRange(convertStringToBits(token.BitPrefix));
            bitBuffer.AddRange(convertIntToBits(length - (int)Math.Pow(2, exp - 1), token.ValueBits));
        }