In the function of link_path_walk() , it counts the hash value of the compoent of the pathname.
Why "(prevhash + (c <<4) + (c >> 4))*11;"?
Thank you.
809 c = *(const unsigned char *)name; 810 811 hash = init_name_hash(); 812 do { 813 name++; 814 hash = partial_name_hash(c, hash); 815 c = *(const unsigned char *)name; 816 } while (c && (c != '/')); 817 this.len = name - (const char *) this.name;
/* Name hashing routines. Initial hash value */ 49 /* Hash courtesy of the R5 hash in reiserfs modulo sign bits */ 50 #define init_name_hash() 0 51 52 /* partial hash update function. Assume roughly 4 bits per character */ 53 static inline unsigned long 54 partial_name_hash(unsigned long c, unsigned long prevhash) 55 { 56 return (prevhash + (c << 4) + (c >> 4)) * 11; 57 }
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies