Commit 192a12fb authored by Patrick Rudolph's avatar Patrick Rudolph Committed by Patrick Georgi
Browse files

commonlib/region: Add region_overlap



Add inline function to check if two regions overlap.

Change-Id: I6f3dfaa9f0805893bd691ba64f112944d89a8e71
Signed-off-by: default avatarPatrick Rudolph <patrick.rudolph@9elements.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/41083

Tested-by: default avatarbuild bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: default avatarJulius Werner <jwerner@chromium.org>
Reviewed-by: default avatarAngel Pons <th3fanbus@gmail.com>
parent 0cdc97cd
......@@ -7,6 +7,7 @@
#include <sys/types.h>
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
#include <commonlib/mem_pool.h>
/*
......@@ -117,6 +118,12 @@ static inline size_t region_end(const struct region *r)
return region_offset(r) + region_sz(r);
}
static inline bool region_overlap(const struct region *r1, const struct region *r2)
{
return (region_end(r1) > region_offset(r2)) &&
(region_offset(r1) < region_end(r2));
}
static inline const struct region *region_device_region(
const struct region_device *rdev)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment