aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-01-03 15:40:49 +0100
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-06-13 05:49:23 +0200
commit5fbbd26babaccac0ee3d6c6036fdea881298a627 (patch)
tree14faedb1deaff87f9a82122018c55a58284e57fe
parent320da0d6a1bfad5bad24600da763cdeabd30c5ba (diff)
downloadsparse-dev-5fbbd26babaccac0ee3d6c6036fdea881298a627.tar.gz
ptrlist: add helper PTR_UNTAG()
The macro PTR_ENTRY() need tp strip possible tag from the entry. Let create a small helper for this 'untagging' operation. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r--ptrlist.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/ptrlist.h b/ptrlist.h
index 9ab3047e..e6e2e616 100644
--- a/ptrlist.h
+++ b/ptrlist.h
@@ -61,8 +61,9 @@ extern int linearize_ptr_list(struct ptr_list *, void **, int);
#define free_ptr_list(list) \
do { VRFY_PTR_LIST(*(list)); __free_ptr_list((struct ptr_list **)(list)); } while (0)
+#define PTR_UNTAG(p) ((void*)(~3UL & (unsigned long)(p)))
#define PTR_ENTRY_NOTAG(h,i) ((h)->list[i])
-#define PTR_ENTRY(h,i) (void *)(~3UL & (unsigned long)PTR_ENTRY_NOTAG(h,i))
+#define PTR_ENTRY(h,i) PTR_UNTAG((h)->list[i])
static inline void *first_ptr_list(struct ptr_list *list)
{