File tree 2 files changed +30
-4
lines changed
2 files changed +30
-4
lines changed Original file line number Diff line number Diff line change @@ -105,8 +105,21 @@ long random(long min, long max);
105
105
#define SERIAL 0x0
106
106
#define DISPLAY 0x1
107
107
108
- #define min (a ,b ) ((a)<(b)?(a):(b))
109
- #define max (a ,b ) ((a)>(b)?(a):(b))
108
+ #ifdef __cplusplus
109
+ #include < algorithm>
110
+ using std::min;
111
+ using std::max;
112
+ #else // C
113
+ #include < stdlib.h>
114
+ #ifndef min
115
+ #define min (a,b ) ((a)<(b)?(a):(b))
116
+ #endif // min
117
+
118
+ #ifndef max
119
+ #define max (a,b ) ((a)>(b)?(a):(b))
120
+ #endif // max
121
+ #endif // __cplusplus
122
+
110
123
#define constrain (amt,low,high ) ((amt)<(low)?(low):((amt)>(high)?(high):(amt)))
111
124
#define round (x ) ((x)>=0 ?(long )((x)+0.5 ):(long )((x)-0.5 ))
112
125
#define radians (deg ) ((deg)*DEG_TO_RAD)
Original file line number Diff line number Diff line change @@ -91,8 +91,21 @@ long random(long min, long max);
91
91
#define DEG_TO_RAD 0.017453292519943295769236907684886
92
92
#define RAD_TO_DEG 57.295779513082320876798154814105
93
93
94
- #define min (a ,b ) ((a)<(b)?(a):(b))
95
- #define max (a ,b ) ((a)>(b)?(a):(b))
94
+ #ifdef __cplusplus
95
+ #include < algorithm>
96
+ using std::min;
97
+ using std::max;
98
+ #else // C
99
+ #include < stdlib.h>
100
+ #ifndef min
101
+ #define min (a,b ) ((a)<(b)?(a):(b))
102
+ #endif // min
103
+
104
+ #ifndef max
105
+ #define max (a,b ) ((a)>(b)?(a):(b))
106
+ #endif // max
107
+ #endif // __cplusplus
108
+
96
109
#define constrain (amt,low,high ) ((amt)<(low)?(low):((amt)>(high)?(high):(amt)))
97
110
#define round (x ) ((x)>=0 ?(long )((x)+0.5 ):(long )((x)-0.5 ))
98
111
#define radians (deg ) ((deg)*DEG_TO_RAD)
You can’t perform that action at this time.
0 commit comments