@@ -194,4 +194,45 @@
(CPPMAGIC_EVAL(_CPPMAGIC_JOIN(d_, __VA_ARGS__))) \
()
+/**
+ * CPPMAGIC_INC - increment the argument
+ * @d: integer between 0 and 32 to increment
+ *
+ * Increments the integer to a maximum of 32 and saturates
+ */
+#define CPPMAGIC_INC(d_) CPPMAGIC_GLUE2(_CPPMAGIC_INC_, d_)
+#define _CPPMAGIC_INC_0 1
+#define _CPPMAGIC_INC_1 2
+#define _CPPMAGIC_INC_2 3
+#define _CPPMAGIC_INC_3 4
+#define _CPPMAGIC_INC_4 5
+#define _CPPMAGIC_INC_5 6
+#define _CPPMAGIC_INC_6 7
+#define _CPPMAGIC_INC_7 8
+#define _CPPMAGIC_INC_8 9
+#define _CPPMAGIC_INC_9 10
+#define _CPPMAGIC_INC_10 11
+#define _CPPMAGIC_INC_11 12
+#define _CPPMAGIC_INC_12 13
+#define _CPPMAGIC_INC_13 14
+#define _CPPMAGIC_INC_14 15
+#define _CPPMAGIC_INC_15 16
+#define _CPPMAGIC_INC_16 17
+#define _CPPMAGIC_INC_17 18
+#define _CPPMAGIC_INC_18 19
+#define _CPPMAGIC_INC_19 20
+#define _CPPMAGIC_INC_20 21
+#define _CPPMAGIC_INC_21 22
+#define _CPPMAGIC_INC_22 23
+#define _CPPMAGIC_INC_23 24
+#define _CPPMAGIC_INC_24 25
+#define _CPPMAGIC_INC_25 26
+#define _CPPMAGIC_INC_26 27
+#define _CPPMAGIC_INC_27 28
+#define _CPPMAGIC_INC_28 29
+#define _CPPMAGIC_INC_29 30
+#define _CPPMAGIC_INC_30 31
+#define _CPPMAGIC_INC_31 32
+#define _CPPMAGIC_INC_32 32
+
#endif /* CCAN_CPPMAGIC_H */
The original ccan module does not include a macro to increment numbers. Add one which will increment upto 32 which is enough for our usage. Signed-off-by: Alistair Popple <alistair@popple.id.au> --- ccan/cppmagic/cppmagic.h | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+)