Source-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: CVS commit: src/sys
Reinoud Zandijk wrote:
> [ ... dirhash stuff ... ]
+static uint32_t
+dirhash_hash(const char *str, int namelen)
+{
+ uint32_t hash = 5381;
+ int i, c;
+
+ for (i = 0; i < namelen; i++) {
+ c = *str++;
+ hash = ((hash << 5) + hash) + c; /* hash * 33 + c */
+ }
+ return hash;
+}
Any reason you can't reuse hash32_strn() from <sys/hash.h> here? That
does add a final "hash + (hash >> 5)" at the end, and I'm not sure what
difference to the distribution that change makes.
Simon.
Home |
Main Index |
Thread Index |
Old Index