| 
									
										
										
										
											2021-05-10 04:56:51 +02:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * SPDX-FileCopyrightText: 2018-2021 Espressif Systems (Shanghai) CO LTD | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * SPDX-License-Identifier: Apache-2.0 | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2018-09-29 17:29:23 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | #pragma once
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-07-20 18:18:47 +08:00
										 |  |  | #include <stdbool.h>
 | 
					
						
							|  |  |  | #include <stdint.h>
 | 
					
						
							|  |  |  | #include <assert.h>
 | 
					
						
							| 
									
										
										
										
											2018-09-29 17:29:23 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-06-26 11:02:15 +10:00
										 |  |  | #ifdef __cplusplus
 | 
					
						
							|  |  |  | extern "C" { | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-29 17:29:23 +08:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * @brief Check if half-open intervals overlap | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * @param start1  interval 1 start | 
					
						
							|  |  |  |  * @param end1    interval 1 end | 
					
						
							|  |  |  |  * @param start2  interval 2 start | 
					
						
							|  |  |  |  * @param end2    interval 2 end | 
					
						
							|  |  |  |  * @return true iff [start1; end1) overlaps [start2; end2) | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | static inline bool bootloader_util_regions_overlap( | 
					
						
							| 
									
										
										
										
											2022-07-20 18:18:47 +08:00
										 |  |  |     const intptr_t start1, const intptr_t end1, | 
					
						
							|  |  |  |     const intptr_t start2, const intptr_t end2) | 
					
						
							| 
									
										
										
										
											2018-09-29 17:29:23 +08:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2022-07-20 18:18:47 +08:00
										 |  |  |     assert(end1 > start1); | 
					
						
							|  |  |  |     assert(end2 > start2); | 
					
						
							| 
									
										
										
										
											2019-06-05 14:43:23 +08:00
										 |  |  |     return (end1 > start2 && end2 > start1); | 
					
						
							| 
									
										
										
										
											2018-09-29 17:29:23 +08:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2019-06-26 11:02:15 +10:00
										 |  |  | 
 | 
					
						
							|  |  |  | #ifdef __cplusplus
 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | #endif
 |