X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/45e1f8b055043e54be35462852ab6649d634da7c..refs/heads/nov/revmap:/lunaix-os/includes/lunaix/ds/hashtable.h diff --git a/lunaix-os/includes/lunaix/ds/hashtable.h b/lunaix-os/includes/lunaix/ds/hashtable.h index c3aea3f..3a38af8 100644 --- a/lunaix-os/includes/lunaix/ds/hashtable.h +++ b/lunaix-os/includes/lunaix/ds/hashtable.h @@ -13,7 +13,7 @@ #ifndef __LUNAIX_HASHTABLE_H #define __LUNAIX_HASHTABLE_H -#include +#include #include struct hbucket @@ -21,9 +21,9 @@ struct hbucket struct hlist_node* head; }; -#define __hashkey(table, hash) (hash % (sizeof(table) / sizeof(table[0]))) +#define __hashkey(table, hash) ((hash) % (sizeof(table) / sizeof(table[0]))) -#define DECLARE_HASHTABLE(name, bucket_num) struct hbucket name[bucket_num]; +#define DECLARE_HASHTABLE(name, bucket_num) struct hbucket name[(bucket_num)]; #define hashtable_bucket_foreach(bucket, pos, n, member) \ for (pos = list_entry((bucket)->head, typeof(*pos), member); \