#ifndef BREEZE_STRING_H
#define BREEZE_STRING_H

#include "../defines.h"

typedef u32 (*BzStringHashFunc)(const char *str);

// djb2 hash algorithm
// From: https://stackoverflow.com/questions/7666509/hash-function-for-string
//       http://www.cse.yorku.ca/~oz/hash.html
static u32 bzStringDefaultHash(const char *str) {
    u32 hash = 5381;
    int c;
    while ((c = (int) *str++)) {
        hash = ((hash << 5) + hash) + c; /* hash + 33 + c */
    }
    return hash;
}

#endif //BREEZE_STRING_H
