File Add-H5_RANGE_OVERLAP.patch of Package hdf5.34857

From: Egbert Eich <eich@suse.com>
Date: Tue May 21 13:48:16 2024 +0200
Subject: Add H5_RANGE_OVERLAP()
Patch-mainline: Upstream
Git-repo: https://github.com/HDFGroup/hdf5
Git-commit: 0ede525f4de5ce8e665793f17a429183f5c401a6
References: bsc#1224158


Signed-off-by: Egbert Eich <eich@suse.de>
---
 src/H5private.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/H5private.h b/src/H5private.h
index 12be7029b4..2b7066f067 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -354,6 +354,15 @@
 /* limit the middle value to be within a range (inclusive) */
 #define RANGE(LO, X, HI) MAX(LO, MIN(X, HI))
 
+/* Macro for checking if two ranges overlap one another */
+/*
+ * Check for the inverse of whether the ranges are disjoint.  If they are
+ * disjoint, then the low bound of one of the ranges must be greater than the
+ * high bound of the other.
+ */
+/* (Assumes that low & high bounds are _inclusive_) */
+#define H5_RANGE_OVERLAP(L1, H1, L2, H2) (!((L1) > (H2) || (L2) > (H1)))
+
 /* absolute value */
 #ifndef ABS
 #define ABS(a) (((a) >= 0) ? (a) : -(a))
openSUSE Build Service is sponsored by