summaryrefslogtreecommitdiff
path: root/polux/application/boottable/inc/overlap.h
diff options
context:
space:
mode:
Diffstat (limited to 'polux/application/boottable/inc/overlap.h')
-rw-r--r--polux/application/boottable/inc/overlap.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/polux/application/boottable/inc/overlap.h b/polux/application/boottable/inc/overlap.h
new file mode 100644
index 0000000000..49ea3865ef
--- /dev/null
+++ b/polux/application/boottable/inc/overlap.h
@@ -0,0 +1,34 @@
+/************************************************************/
+/* Spidcom Technologies
+
+FILE NAME : overlap.h
+
+DESCRIPTION : overlap utility inlined function
+
+HISTORY :
+--------------------------------------------------------------
+DATE | AUTHOR | Version | Description
+--------------------------------------------------------------
+20/02/04 | Petillon | 1.0 | Creation
+*/
+/************************************************************/
+
+#ifndef OVERLAP_H
+#define OVERLAP_H
+
+#include <stdint.h>
+
+/*!\brief Test if memory regions overlap.
+
+\param addr1 start address of region 1
+\param size1 size of region 1
+\param addr2 start address of region 2
+\param size2 size of region 2
+\return 0 if regions do not overlap
+*/
+static INLINE int overlap(caddr_t addr1, size_t s1, caddr_t addr2, size_t s2)
+{
+ return (addr1>=addr2 && addr1<addr2+s2) || (addr2>=addr1 && addr2<addr1+s1);
+}
+
+#endif // OVERLAP_H