Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement djb2 hash function for hashmap DS #14

Open
iWas-Coder opened this issue Dec 11, 2024 · 0 comments
Open

Implement djb2 hash function for hashmap DS #14

iWas-Coder opened this issue Dec 11, 2024 · 0 comments
Labels
✨ feature New feature or request

Comments

@iWas-Coder
Copy link
Member

iWas-Coder commented Dec 11, 2024

image
https://theartincode.stanis.me/008-djb2/

Need to modify this function:

CARBON_INLINE u64 carbon_hashmap__hash(const char *key, u32 n) {
u64 hash = 0;
for (const u8 *p = (const u8 *) key; *p; ++p) {
hash = (hash * 97) + *p;
}
return hash % n;
}

@iWas-Coder iWas-Coder added the ✨ feature New feature or request label Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ feature New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant