diff options
author | Alistair Popple <alistair@popple.id.au> | 2018-06-20 15:34:04 +1000 |
---|---|---|
committer | Alistair Popple <alistair@popple.id.au> | 2018-06-25 15:57:55 +1000 |
commit | 0b9decd0831bfad3cec0b79e776edc23b7c220ce (patch) | |
tree | a1fe3ed137b816d6d06bf0dcff7037df6117b101 /ccan | |
parent | 46e912aace2ef46734e9626f1627f70063130492 (diff) | |
download | pdbg-0b9decd0831bfad3cec0b79e776edc23b7c220ce.tar.gz pdbg-0b9decd0831bfad3cec0b79e776edc23b7c220ce.zip |
ccan/cppmagic: Add CPPMAGIC_INC(x) macro
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>
Diffstat (limited to 'ccan')
-rw-r--r-- | ccan/cppmagic/cppmagic.h | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/ccan/cppmagic/cppmagic.h b/ccan/cppmagic/cppmagic.h index 587fe4e..ffd5848 100644 --- a/ccan/cppmagic/cppmagic.h +++ b/ccan/cppmagic/cppmagic.h @@ -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 */ |