mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-31 15:12:06 +00:00 
			
		
		
		
	likely
This commit is contained in:
		| @@ -5,11 +5,13 @@ | ||||
|  | ||||
| // Branch prediction hints for performance-critical paths | ||||
| #if defined(__GNUC__) || defined(__clang__) | ||||
| // GCC and Clang: use __builtin_expect for better optimization | ||||
| #define ESPHOME_LIKELY(x) __builtin_expect(!!(x), 1) | ||||
| #define ESPHOME_UNLIKELY(x) __builtin_expect(!!(x), 0) | ||||
| #else | ||||
| #define ESPHOME_LIKELY(x) (x) | ||||
| #define ESPHOME_UNLIKELY(x) (x) | ||||
| // Other C++20 compilers: use standard attributes | ||||
| #define ESPHOME_LIKELY(x) (x) [[likely]] | ||||
| #define ESPHOME_UNLIKELY(x) (x) [[unlikely]] | ||||
| #endif | ||||
|  | ||||
| #ifdef USE_ARDUINO | ||||
|   | ||||
		Reference in New Issue
	
	Block a user