1 /* 2 * SPDX-FileCopyrightText: 2018-2021 Espressif Systems (Shanghai) CO LTD 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #pragma once 8 9 #include <stdbool.h> 10 #include <stdint.h> 11 #include <assert.h> 12 13 #ifdef __cplusplus 14 extern "C" { 15 #endif 16 17 /** 18 * @brief Check if half-open intervals overlap 19 * 20 * @param start1 interval 1 start 21 * @param end1 interval 1 end 22 * @param start2 interval 2 start 23 * @param end2 interval 2 end 24 * @return true iff [start1; end1) overlaps [start2; end2) 25 */ bootloader_util_regions_overlap(const intptr_t start1,const intptr_t end1,const intptr_t start2,const intptr_t end2)26static inline bool bootloader_util_regions_overlap( 27 const intptr_t start1, const intptr_t end1, 28 const intptr_t start2, const intptr_t end2) 29 { 30 assert(end1 > start1); 31 assert(end2 > start2); 32 return (end1 > start2 && end2 > start1); 33 } 34 35 #ifdef __cplusplus 36 } 37 #endif 38