X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=ucw%2Fhashfunc.c;h=ada2a43f22f920856571fd2fff98c95eaac01985;hb=3bf739559578b42ef385479feb602b2dfe1f41b5;hp=bfd76cfe8b1fad9a5e7076c812085e9ac3562e43;hpb=031256ad2e123eec58521f8e3eb9496c197641d2;p=libucw.git diff --git a/ucw/hashfunc.c b/ucw/hashfunc.c index bfd76cfe..ada2a43f 100644 --- a/ucw/hashfunc.c +++ b/ucw/hashfunc.c @@ -11,9 +11,9 @@ * of the GNU Lesser General Public License. */ -#include "ucw/lib.h" -#include "ucw/hashfunc.h" -#include "ucw/chartype.h" +#include +#include +#include /* The number of bits the hash in the function hash_*() is rotated by after * every pass. It should be prime with the word size. */ @@ -97,9 +97,9 @@ hash_string_aligned(const char *str) } inline uns -hash_block_aligned(const byte *str, uns len) +hash_block_aligned(const byte *buf, uns len) { - const uns *u = (const uns *) str; + const uns *u = (const uns *) buf; uns hash = 0; while (len >= sizeof(uns)) { @@ -159,11 +159,11 @@ hash_string(const char *str) } uns -hash_block(const byte *str, uns len) +hash_block(const byte *buf, uns len) { - uns shift = UNALIGNED_PART(str, uns); + uns shift = UNALIGNED_PART(buf, uns); if (!shift) - return hash_block_aligned(str, len); + return hash_block_aligned(buf, len); else { uns hash = 0; @@ -181,7 +181,7 @@ hash_block(const byte *str, uns len) hash = ROL(hash, SHIFT_BITS); if (i >= len) break; - hash ^= str[i] << (shift * 8); + hash ^= buf[i] << (shift * 8); } return hash; }