X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/45e1f8b055043e54be35462852ab6649d634da7c..f044ca812256b421e793c4335ce1ffed74710a70:/lunaix-os/includes/lunaix/ds/hashtable.h?ds=sidebyside diff --git a/lunaix-os/includes/lunaix/ds/hashtable.h b/lunaix-os/includes/lunaix/ds/hashtable.h index c3aea3f..41ca36b 100644 --- a/lunaix-os/includes/lunaix/ds/hashtable.h +++ b/lunaix-os/includes/lunaix/ds/hashtable.h @@ -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); \