1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2024-11-25 08:37:38 +01:00

Add helper macros for pointer arithmetics

ALIGN lets you align pointers and STRUCT_MEMBER lets you get
structure members at a specific offset.

These are useful in general, and will be needed for the coredump notes
cleanup work.
This commit is contained in:
Alexander Larsson 2012-03-26 11:18:22 +02:00 committed by Arun Sharma
parent b1393b7e63
commit edcc521a0e

View file

@ -99,4 +99,8 @@ struct UCD_info
extern coredump_phdr_t * _UCD_get_elf_image(struct UCD_info *ui, unw_word_t ip); extern coredump_phdr_t * _UCD_get_elf_image(struct UCD_info *ui, unw_word_t ip);
#define ALIGN(x,a) (((x)+(a)-1UL)&~((a)-1UL))
#define STRUCT_MEMBER_P(struct_p, struct_offset) ((void *) ((char*) (struct_p) + (long) (struct_offset)))
#define STRUCT_MEMBER(member_type, struct_p, struct_offset) (*(member_type*) STRUCT_MEMBER_P ((struct_p), (struct_offset)))
#endif #endif