summaryrefslogtreecommitdiff
path: root/include/libelfu/generic.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/libelfu/generic.h')
-rw-r--r--include/libelfu/generic.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/include/libelfu/generic.h b/include/libelfu/generic.h
index f5b0e0f..09d2ffc 100644
--- a/include/libelfu/generic.h
+++ b/include/libelfu/generic.h
@@ -3,9 +3,22 @@
#include <libelf/gelf.h>
+#define OFFS_END(off, sz) ((off) + (sz))
+
+#define OVERLAPPING(off1, sz1, off2, sz2) \
+ (!((off1) == (off2) && ((sz1 == 0) || (sz2 == 0))) \
+ && (((off1) <= (off2) && (off2) < OFFS_END((off1), (sz1))) \
+ || ((off2) <= (off1) && (off1) < OFFS_END((off2), (sz2)))) \
+ )
+
+#define FULLY_OVERLAPPING(off1, sz1, off2, sz2) \
+ (((off1) <= (off2) && OFFS_END((off2), (sz2)) <= OFFS_END((off1), (sz1))) \
+ || ((off2) <= (off1) && OFFS_END((off1), (sz1)) <= OFFS_END((off2), (sz2))))
+
-size_t elfu_gScnSizeFile(const GElf_Shdr *shdr);
int elfu_gPhdrContainsScn(GElf_Phdr *phdr, GElf_Shdr *shdr);
+size_t elfu_gScnSizeFile(const GElf_Shdr *shdr);
+
#endif