public HashTable(byte[] input)
            {
                this.input = input;

                this.table = GetHashTable(input.Length);
                this.shift = 64 - Log2.Floor(table.Length);
            }
Example #2
0
        /// <summary>
        /// Initializes a new ring buffer, with the values and size of the provided <paramref name="values"/>.
        /// </summary>
        /// <param name="values">Initial values placed into the buffer. Element at [0] is at the back of the queue.</param>
        public RingBufferFast(T[] values)
        {
            int length = values.Length;

            if (length == 0)
            {
                throw new ArgumentException("Ring buffer size cannot be zero.");
            }
            else if (length != 1 << Log2.Floor(length))
            {
                throw new ArgumentException("Fast ring buffer size must be a power of 2.");
            }

            this.values = values;
            this.mask   = length - 1;
        }
 public static int BackwardReferenceScore(int copyLength, int backwardReferenceOffset)
 {
     return(ScoreBase + (LiteralByteScore * copyLength) - (DistanceBitPenalty * Log2.Floor(backwardReferenceOffset)));
 }