git://scm.lunaixsky.com
/
lunaix-os.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
reduce the size of ppage by 8 bytes using signly linked list
[lunaix-os.git]
/
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 5dab1cbbeb559a9ebb8a6c484e1322ade1a4ded6..77096aa8a845f6c35dbb0d0152bb94f61734dd1c 100644
(file)
--- a/
lunaix-os/includes/lunaix/ds/hstr.h
+++ b/
lunaix-os/includes/lunaix/ds/hstr.h
@@
-1,14
+1,14
@@
#ifndef __LUNAIX_HSTR_H
#define __LUNAIX_HSTR_H
#ifndef __LUNAIX_HSTR_H
#define __LUNAIX_HSTR_H
-#include <
lib
/hash.h>
+#include <
klibc
/hash.h>
#define HSTR_FULL_HASH 32
struct hstr
{
#define HSTR_FULL_HASH 32
struct hstr
{
- u
int32_
t hash;
- u
int32_
t len;
+ u
nsigned in
t hash;
+ u
nsigned in
t len;
const char* value;
};
const char* value;
};
@@
-26,8
+26,12
@@
struct hstr
#define HSTR_EQ(str1, str2) ((str1)->hash == (str2)->hash)
#define HSTR_EQ(str1, str2) ((str1)->hash == (str2)->hash)
-inline void
-hstr_rehash(struct hstr* hash_str, uint32_t truncate_to)
+#define HSTR_VAL(hstr) ((hstr).value)
+#define HSTR_LEN(hstr) ((hstr).len)
+#define HSTR_HASH(hstr) ((hstr).hash)
+
+static inline void
+hstr_rehash(struct hstr* hash_str, u32_t truncate_to)
{
hash_str->hash = strhash_32(hash_str->value, truncate_to);
}
{
hash_str->hash = strhash_32(hash_str->value, truncate_to);
}