Skip to content

The "char" type might be signed, both hash functions are defined to w…#15

Open
gene-hightower wants to merge 1 commit intoduckduckgo:developfrom
gene-hightower:chars-might-be-signed
Open

The "char" type might be signed, both hash functions are defined to w…#15
gene-hightower wants to merge 1 commit intoduckduckgo:developfrom
gene-hightower:chars-might-be-signed

Conversation

@gene-hightower
Copy link

…ork on unsigned 8-bit values.

Description:

For example, DJB's C code for this hash function is:

uint32 cdb_hash(buf,len)
unsigned char *buf;
unsigned int len;
{
uint32 h;

h = 5381;
while (len) {
--len;
h += (h << 5);
h ^= (uint32) *buf++;
}
return h;
}

This code uses + in place of ^, but that I think is a choice and not just an oversight.

Steps to test this PR:
1.
1.


Internal references:

Software Engineering Expectations
Technical Design Template

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant