This commit is contained in:
2025-02-03 12:30:01 +05:00
parent fd9e5dda78
commit b443367f46
5 changed files with 163 additions and 7 deletions

View File

@@ -97,3 +97,12 @@ bool str_endsWith(str src, str fragment){
src.len = fragment.len;
return str_equals(src, fragment);
}
u32 str_hash32(str s){
u8* ubuf = (u8*)s.data;
u32 len = s.len;
u32 hash=0;
for (u32 i = 0; i < len; i++)
hash = (hash<<6) + (hash<<16) - hash + ubuf[i];
return hash;
}