X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/4769a870917b98723690aa336d12d0656769528b..07dec283edc4b849c42efa9fbd23c6e9247e8788:/lunaix-os/includes/lunaix/ds/hstr.h diff --git a/lunaix-os/includes/lunaix/ds/hstr.h b/lunaix-os/includes/lunaix/ds/hstr.h index 4864052..f3fa89e 100644 --- a/lunaix-os/includes/lunaix/ds/hstr.h +++ b/lunaix-os/includes/lunaix/ds/hstr.h @@ -3,6 +3,8 @@ #include +#define HSTR_FULL_HASH 32 + struct hstr { unsigned int hash; @@ -13,9 +15,17 @@ struct hstr #define HSTR(str, length) \ (struct hstr) \ { \ - .len = length, .value = str \ + .len = (length), .value = (str) \ + } + +#define HHSTR(str, length, strhash) \ + (struct hstr) \ + { \ + .len = (length), .value = (str), .hash = (strhash) \ } +#define HSTR_EQ(str1, str2) ((str1)->hash == (str2)->hash) + inline void hstr_rehash(struct hstr* hash_str, unsigned int truncate_to) {