|
|
|
@ -295,8 +295,8 @@ typedef float feedRate_t;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
// Use NUM_ARGS(__VA_ARGS__) to get the number of variadic arguments
|
|
|
|
|
#define _NUM_ARGS(_0,_24_,_23,_22,_21,_20,_19,_18,_17,_16,_15,_14,_13,_12,_11,_10,_9,_8,_7,_6,_5,_4,_3,_2,_1,N,...) N
|
|
|
|
|
#define NUM_ARGS(V...) _NUM_ARGS(0,V,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)
|
|
|
|
|
#define _NUM_ARGS(_,Z,Y,X,W,V,U,T,S,R,Q,P,O,N,M,L,K,J,I,H,G,F,E,D,C,B,A,OUT,...) OUT
|
|
|
|
|
#define NUM_ARGS(V...) _NUM_ARGS(0,V,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
|
|
|
|
@ -322,29 +322,29 @@ typedef float feedRate_t;
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
|
|
#define MIN_2(a,b) ((a)<(b)?(a):(b))
|
|
|
|
|
#define MIN_3(a,...) MIN_2(a,MIN_2(__VA_ARGS__))
|
|
|
|
|
#define MIN_4(a,...) MIN_2(a,MIN_3(__VA_ARGS__))
|
|
|
|
|
#define MIN_5(a,...) MIN_2(a,MIN_4(__VA_ARGS__))
|
|
|
|
|
#define MIN_6(a,...) MIN_2(a,MIN_5(__VA_ARGS__))
|
|
|
|
|
#define MIN_7(a,...) MIN_2(a,MIN_6(__VA_ARGS__))
|
|
|
|
|
#define MIN_8(a,...) MIN_2(a,MIN_7(__VA_ARGS__))
|
|
|
|
|
#define MIN_9(a,...) MIN_2(a,MIN_8(__VA_ARGS__))
|
|
|
|
|
#define MIN_10(a,...) MIN_2(a,MIN_9(__VA_ARGS__))
|
|
|
|
|
#define __MIN_N(N, ...) MIN_##N(__VA_ARGS__)
|
|
|
|
|
#define _MIN_N(N, ...) __MIN_N(N,__VA_ARGS__)
|
|
|
|
|
#define _MIN(...) _MIN_N(NUM_ARGS(__VA_ARGS__), __VA_ARGS__)
|
|
|
|
|
#define MIN_3(a,V...) MIN_2(a,MIN_2(V))
|
|
|
|
|
#define MIN_4(a,V...) MIN_2(a,MIN_3(V))
|
|
|
|
|
#define MIN_5(a,V...) MIN_2(a,MIN_4(V))
|
|
|
|
|
#define MIN_6(a,V...) MIN_2(a,MIN_5(V))
|
|
|
|
|
#define MIN_7(a,V...) MIN_2(a,MIN_6(V))
|
|
|
|
|
#define MIN_8(a,V...) MIN_2(a,MIN_7(V))
|
|
|
|
|
#define MIN_9(a,V...) MIN_2(a,MIN_8(V))
|
|
|
|
|
#define MIN_10(a,V...) MIN_2(a,MIN_9(V))
|
|
|
|
|
#define __MIN_N(N,V...) MIN_##N(V)
|
|
|
|
|
#define _MIN_N(N,V...) __MIN_N(N,V)
|
|
|
|
|
#define _MIN(V...) _MIN_N(NUM_ARGS(V), V)
|
|
|
|
|
|
|
|
|
|
#define MAX_2(a,b) ((a)>(b)?(a):(b))
|
|
|
|
|
#define MAX_3(a,...) MAX_2(a,MAX_2(__VA_ARGS__))
|
|
|
|
|
#define MAX_4(a,...) MAX_2(a,MAX_3(__VA_ARGS__))
|
|
|
|
|
#define MAX_5(a,...) MAX_2(a,MAX_4(__VA_ARGS__))
|
|
|
|
|
#define MAX_6(a,...) MAX_2(a,MAX_5(__VA_ARGS__))
|
|
|
|
|
#define MAX_7(a,...) MAX_2(a,MAX_6(__VA_ARGS__))
|
|
|
|
|
#define MAX_8(a,...) MAX_2(a,MAX_7(__VA_ARGS__))
|
|
|
|
|
#define MAX_9(a,...) MAX_2(a,MAX_8(__VA_ARGS__))
|
|
|
|
|
#define MAX_10(a,...) MAX_2(a,MAX_9(__VA_ARGS__))
|
|
|
|
|
#define __MAX_N(N, ...) MAX_##N(__VA_ARGS__)
|
|
|
|
|
#define _MAX_N(N, ...) __MAX_N(N,__VA_ARGS__)
|
|
|
|
|
#define _MAX(...) _MAX_N(NUM_ARGS(__VA_ARGS__), __VA_ARGS__)
|
|
|
|
|
#define MAX_3(a,V...) MAX_2(a,MAX_2(V))
|
|
|
|
|
#define MAX_4(a,V...) MAX_2(a,MAX_3(V))
|
|
|
|
|
#define MAX_5(a,V...) MAX_2(a,MAX_4(V))
|
|
|
|
|
#define MAX_6(a,V...) MAX_2(a,MAX_5(V))
|
|
|
|
|
#define MAX_7(a,V...) MAX_2(a,MAX_6(V))
|
|
|
|
|
#define MAX_8(a,V...) MAX_2(a,MAX_7(V))
|
|
|
|
|
#define MAX_9(a,V...) MAX_2(a,MAX_8(V))
|
|
|
|
|
#define MAX_10(a,V...) MAX_2(a,MAX_9(V))
|
|
|
|
|
#define __MAX_N(N,V...) MAX_##N(V)
|
|
|
|
|
#define _MAX_N(N,V...) __MAX_N(N,V)
|
|
|
|
|
#define _MAX(V...) _MAX_N(NUM_ARGS(V), V)
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|