o_ComputeHashFromTo

open override fun o_ComputeHashFromTo(    self: AvailObject,     start: Int,     end: Int): Int

Compute the hash value from the object's data. The result should be an int. To keep the rehashing cost down for concatenated tuples, we use a non-commutative hash function. If the tuple has elements with hash values h1hn , we use the formula h1a1+h2a2++hnan /. This can be rewritten as i=1nhiai ). The constant a is chosen as a primitive element of the group 232, specifically 1,664,525, as taken from Knuth, The Art of Computer Programming, Vol. 2, 2nd ed., page 102, row 26. See also pages 19, 20, theorems B and C. The period of this cycle is 230.

To append an (n+1)st element to a tuple, one can compute the new hash by adding hn1an1 to the previous hash. Similarly, concatenating two tuples of length x and y is a simple matter of multiplying the right tuple's hash by ax and adding it to the left tuple's hash.

The element hash values are exclusive-ored with preToggle before being used, to help prevent similar nested tuples from producing equal hashes.

Parameters

self

The object containing elements to hash.

start

The first index of elements to hash.

end

The last index of elements to hash.