Scan build: Result of operation is garbage or undefined

This commit is contained in:
mir
2024-03-07 11:00:57 +01:00
parent b99e856733
commit fc8d0c59c6
27 changed files with 81 additions and 38 deletions
+15 -3
View File
@@ -19,9 +19,21 @@ extern "C" {
#define sizeofArray(a) (sizeof(a)/sizeof(*(a)))
#define cmax(a,b) ((a>b) ? (a) : (b))
#define cmax3(a,b,c) ((cmax(a,b)>c) ? (cmax(a,b)) : (c))
#define cmin(a,b) ((a<b) ? (a) : (b))
// Prevent double evaluation in max macro
#define cmax(a,b) ({ __typeof__ (a) _a = (a); \
__typeof__ (b) _b = (b); \
_a > _b ? _a : _b; })
#define cmax3(a,b,c) ( cmax(cmax(a,b), cmax(b,c)) )
// Prevent double evaluation in min macro
#define cmin(a,b) ({ __typeof__ (a) _a = (a); \
__typeof__ (b) _b = (b); \
_a < _b ? _a : _b; })
#ifdef __cplusplus
#ifdef min