blua: handle 0 length strings in hash_sparse
This commit is contained in:
1 parent
966f60f590
commit
f6ead71f0c
1 file changed
+3
@@ -90,6 +90,9 @@ static unsigned hash_sparse(const char *str, size_t len)
|
||||
{
|
||||
/* Constants taken from lookup3 hash by Bob Jenkins. */
|
||||
unsigned int a, b, h = cast(unsigned int, len);
|
||||
|
||||
if (len == 0) return 0;
|
||||
|
||||
#define rol(x, n) (((x)<<(n)) | ((x)>>(-cast(int, n)&(8*sizeof(x)-1))))
|
||||
if (len >= 4) { /* Caveat: unaligned access! */
|
||||
a = getu32(str);
|
||||
|
||||
Reference in new issue
Block a user