Example #1
0
        private int hashFunction()
        {
            /* Set up the internal state */
            int a = unchecked ((int)0x9e3779b9); /* the golden ratio; an arbitrary value */
            int b = unchecked ((int)0x9e3779b9); /* the golden ratio; an arbitrary value */
            int c = 3;                           /* the previous hash value */

            /*------------------------------------- handle the last 11 bytes */
            a += (getAnnotations().GetHashCode() << 16);
            a += (next.GetHashCode() << 8);
            a += (first.GetHashCode());

            a -= b;
            a -= c;
            a ^= (c >> 13);
            b -= c;
            b -= a;
            b ^= (a << 8);
            c -= a;
            c -= b;
            c ^= (b >> 13);
            a -= b;
            a -= c;
            a ^= (c >> 12);
            b -= c;
            b -= a;
            b ^= (a << 16);
            c -= a;
            c -= b;
            c ^= (b >> 5);
            a -= b;
            a -= c;
            a ^= (c >> 3);
            b -= c;
            b -= a;
            b ^= (a << 10);
            c -= a;
            c -= b;
            c ^= (b >> 15);

            /*-------------------------------------------- report the result */
            return(c);
        }