X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=rculfhash.c;h=2ec91f2f51b6ffd37a7d295a66f52c99ade80791;hb=d37166c6086a55443a65997f9aa3f0a61db8638b;hp=3120d4585995c030a999903b0667d803ebf5b877;hpb=cc4fcb1069347d2b5fbf71a61e7c1712df9a177a;p=userspace-rcu.git diff --git a/rculfhash.c b/rculfhash.c index 3120d45..2ec91f2 100644 --- a/rculfhash.c +++ b/rculfhash.c @@ -53,6 +53,9 @@ #define max(a, b) ((a) > (b) ? (a) : (b)) #endif +#define REMOVED_FLAG (1UL << 0) +#define FLAGS_MASK ((1UL << 1) - 1) + struct rcu_table { unsigned long size; /* always a power of 2 */ unsigned long resize_target; @@ -176,19 +179,19 @@ void check_resize(struct rcu_ht *ht, struct rcu_table *t, static struct rcu_ht_node *clear_flag(struct rcu_ht_node *node) { - return (struct rcu_ht_node *) (((unsigned long) node) & ~0x1); + return (struct rcu_ht_node *) (((unsigned long) node) & ~FLAGS_MASK); } static int is_removed(struct rcu_ht_node *node) { - return ((unsigned long) node) & 0x1; + return ((unsigned long) node) & REMOVED_FLAG; } static struct rcu_ht_node *flag_removed(struct rcu_ht_node *node) { - return (struct rcu_ht_node *) (((unsigned long) node) | 0x1); + return (struct rcu_ht_node *) (((unsigned long) node) | REMOVED_FLAG); } static