common.h: define MIN and MAX macro only if nod defined yet (#1896)

This fix compilation error for Kinetis and Cypress if common.h
is included after platform includes which also defines MIN MAX.
This commit is contained in:
Andrey G 2020-10-22 15:41:44 +03:00 committed by GitHub
parent c0c1eefd55
commit 9359c15cc1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -22,8 +22,12 @@
#ifndef COMMON_H_INCLUDED
#define COMMON_H_INCLUDED
#if !defined(MIN)
#define MIN(a,b) (((a)<(b))?(a):(b))
#endif
#if !defined(MAX)
#define MAX(a,b) (((a)>(b))?(a):(b))
#endif
#define CLAMP(x, low, high) ({\
__typeof__(x) __x = (x); \