Browse Source

Additional TERN macros

Scott Lahteine 5 years ago
parent
commit
528907cb16
1 changed files with 3 additions and 0 deletions
  1. 3
    0
      Marlin/src/core/macros.h

+ 3
- 0
Marlin/src/core/macros.h View File

194
 #define DISABLED(V...)      DO(DIS,&&,V)
194
 #define DISABLED(V...)      DO(DIS,&&,V)
195
 
195
 
196
 #define TERN(O,A,B)         _TERN(_ENA_1(O),B,A)    // OPTION converted to '0' or '1'
196
 #define TERN(O,A,B)         _TERN(_ENA_1(O),B,A)    // OPTION converted to '0' or '1'
197
+#define TERN0(O,A)          _TERN(_ENA_1(O),0,A)    // OPTION converted to A or '0'
198
+#define TERN1(O,A)          _TERN(_ENA_1(O),1,A)    // OPTION converted to A or '1'
199
+#define TERN_(O,A)          _TERN(_ENA_1(O),,A)     // OPTION converted to A or '<nul>'
197
 #define _TERN(E,V...)       __TERN(_CAT(T_,E),V)    // Prepend 'T_' to get 'T_0' or 'T_1'
200
 #define _TERN(E,V...)       __TERN(_CAT(T_,E),V)    // Prepend 'T_' to get 'T_0' or 'T_1'
198
 #define __TERN(T,V...)      ___TERN(_CAT(_NO,T),V)  // Prepend '_NO' to get '_NOT_0' or '_NOT_1'
201
 #define __TERN(T,V...)      ___TERN(_CAT(_NO,T),V)  // Prepend '_NO' to get '_NOT_0' or '_NOT_1'
199
 #define ___TERN(P,V...)     THIRD(P,V)              // If first argument has a comma, A. Else B.
202
 #define ___TERN(P,V...)     THIRD(P,V)              // If first argument has a comma, A. Else B.

Loading…
Cancel
Save