|
|
1.1 ! root 1: /* ! 2: * K. P. Vo ! 3: * G. S. Fowler ! 4: * AT&T Bell Laboratories ! 5: * ! 6: * ``the best'' combined linear congruent checksum/hash/PRNG ! 7: */ ! 8: ! 9: #ifndef HASHPART ! 10: ! 11: #define HASH_ADD(h) (0x9c39c33dL) ! 12: ! 13: #if __sparc__ || sparc ! 14: ! 15: #define HASH_A(h,n) ((((h) << 2) - (h)) << (n)) ! 16: #define HASH_B(h,n) ((((h) << 4) - (h)) << (n)) ! 17: #define HASH_C(h,n) ((HASH_A(h,7) + HASH_B(h,0)) << (n)) ! 18: #define HASH_MPY(h) (HASH_C(h,22)+HASH_C(h,10)+HASH_A(h,6)+HASH_A(h,3)+(h)) ! 19: ! 20: #else ! 21: ! 22: #define HASH_MPY(h) ((h)*0x63c63cd9L) ! 23: ! 24: #endif ! 25: ! 26: #define HASHPART(h,c) (h = HASH_MPY(h) + HASH_ADD(h) + (c)) ! 27: ! 28: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.