diff --git a/src/dir/dir.c b/src/dir/dir.c index b7f40a3373..cfbf2d3da6 100644 --- a/src/dir/dir.c +++ b/src/dir/dir.c @@ -478,7 +478,7 @@ DirHash(register char *string) { /* Hash a string to a number between 0 and NHASHENT. */ register unsigned char tc; - register int hval; + unsigned int hval; register int tval; hval = 0; while ((tc = (*string++))) { @@ -488,7 +488,7 @@ DirHash(register char *string) tval = hval & (NHASHENT - 1); if (tval == 0) return tval; - else if (hval < 0) + else if (hval >= 1<<31) tval = NHASHENT - tval; return tval; }