From 849ab2aefcf8c15110ea9ea43137bf0edc353314 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 12 Nov 2023 19:09:07 +0800 Subject: [PATCH] save --- include/wjr/preprocessor/arithmatic/cmp.hpp | 2 +- include/wjr/preprocessor/arithmatic/neg.hpp | 72 +++++++++++++++++++++ include/wjr/preprocessor/arithmatic/not.hpp | 72 --------------------- include/wjr/preprocessor/arithmatic/sub.hpp | 2 +- include/wjr/preprocessor/details/basic.hpp | 12 +++- 5 files changed, 85 insertions(+), 75 deletions(-) create mode 100644 include/wjr/preprocessor/arithmatic/neg.hpp delete mode 100644 include/wjr/preprocessor/arithmatic/not.hpp diff --git a/include/wjr/preprocessor/arithmatic/cmp.hpp b/include/wjr/preprocessor/arithmatic/cmp.hpp index 20d08432..4a947600 100644 --- a/include/wjr/preprocessor/arithmatic/cmp.hpp +++ b/include/wjr/preprocessor/arithmatic/cmp.hpp @@ -16,7 +16,7 @@ #define WJR_PP_ADD_OVERFLOW(x, y) \ WJR_PP_ADD_OVERFLOW_I( \ WJR_PP_CONCAT(WJR_PP_ARITHMATIC_FROM_NUMBER(x), \ - WJR_PP_ARITHMATIC_FROM_NUMBER(WJR_PP_INC(WJR_PP_NOT(y))))) + WJR_PP_ARITHMATIC_FROM_NUMBER(WJR_PP_INC(WJR_PP_NEG(y))))) #define WJR_PP_ADD_OVERFLOW_I(x) WJR_PP_ADD_OVERFLOW_II(x) #define WJR_PP_ADD_OVERFLOW_II(x) __wjr_arithmatic_add_overflow_##x diff --git a/include/wjr/preprocessor/arithmatic/neg.hpp b/include/wjr/preprocessor/arithmatic/neg.hpp new file mode 100644 index 00000000..97d9ba58 --- /dev/null +++ b/include/wjr/preprocessor/arithmatic/neg.hpp @@ -0,0 +1,72 @@ +#ifndef WJR_PREPROCESSOR_ARITHMATIC_NEG_HPP__ +#define WJR_PREPROCESSOR_ARITHMATIC_NEG_HPP__ + +#define WJR_PP_NEG(x) WJR_PP_NEG_I(x) +#define WJR_PP_NEG_I(x) WJR_PP_NEG_ ## x + +#define WJR_PP_NEG_0 63 +#define WJR_PP_NEG_1 62 +#define WJR_PP_NEG_2 61 +#define WJR_PP_NEG_3 60 +#define WJR_PP_NEG_4 59 +#define WJR_PP_NEG_5 58 +#define WJR_PP_NEG_6 57 +#define WJR_PP_NEG_7 56 +#define WJR_PP_NEG_8 55 +#define WJR_PP_NEG_9 54 +#define WJR_PP_NEG_10 53 +#define WJR_PP_NEG_11 52 +#define WJR_PP_NEG_12 51 +#define WJR_PP_NEG_13 50 +#define WJR_PP_NEG_14 49 +#define WJR_PP_NEG_15 48 +#define WJR_PP_NEG_16 47 +#define WJR_PP_NEG_17 46 +#define WJR_PP_NEG_18 45 +#define WJR_PP_NEG_19 44 +#define WJR_PP_NEG_20 43 +#define WJR_PP_NEG_21 42 +#define WJR_PP_NEG_22 41 +#define WJR_PP_NEG_23 40 +#define WJR_PP_NEG_24 39 +#define WJR_PP_NEG_25 38 +#define WJR_PP_NEG_26 37 +#define WJR_PP_NEG_27 36 +#define WJR_PP_NEG_28 35 +#define WJR_PP_NEG_29 34 +#define WJR_PP_NEG_30 33 +#define WJR_PP_NEG_31 32 +#define WJR_PP_NEG_32 31 +#define WJR_PP_NEG_33 30 +#define WJR_PP_NEG_34 29 +#define WJR_PP_NEG_35 28 +#define WJR_PP_NEG_36 27 +#define WJR_PP_NEG_37 26 +#define WJR_PP_NEG_38 25 +#define WJR_PP_NEG_39 24 +#define WJR_PP_NEG_40 23 +#define WJR_PP_NEG_41 22 +#define WJR_PP_NEG_42 21 +#define WJR_PP_NEG_43 20 +#define WJR_PP_NEG_44 19 +#define WJR_PP_NEG_45 18 +#define WJR_PP_NEG_46 17 +#define WJR_PP_NEG_47 16 +#define WJR_PP_NEG_48 15 +#define WJR_PP_NEG_49 14 +#define WJR_PP_NEG_50 13 +#define WJR_PP_NEG_51 12 +#define WJR_PP_NEG_52 11 +#define WJR_PP_NEG_53 10 +#define WJR_PP_NEG_54 9 +#define WJR_PP_NEG_55 8 +#define WJR_PP_NEG_56 7 +#define WJR_PP_NEG_57 6 +#define WJR_PP_NEG_58 5 +#define WJR_PP_NEG_59 4 +#define WJR_PP_NEG_60 3 +#define WJR_PP_NEG_61 2 +#define WJR_PP_NEG_62 1 +#define WJR_PP_NEG_63 0 + +#endif // ! WJR_PREPROCESSOR_ARITHMATIC_NEG_HPP__ \ No newline at end of file diff --git a/include/wjr/preprocessor/arithmatic/not.hpp b/include/wjr/preprocessor/arithmatic/not.hpp deleted file mode 100644 index 27465648..00000000 --- a/include/wjr/preprocessor/arithmatic/not.hpp +++ /dev/null @@ -1,72 +0,0 @@ -#ifndef WJR_PREPROCESSOR_ARITHMATIC_NOT_HPP__ -#define WJR_PREPROCESSOR_ARITHMATIC_NOT_HPP__ - -#define WJR_PP_NOT(x) WJR_PP_NOT_I(x) -#define WJR_PP_NOT_I(x) WJR_PP_NOT_ ## x - -#define WJR_PP_NOT_0 63 -#define WJR_PP_NOT_1 62 -#define WJR_PP_NOT_2 61 -#define WJR_PP_NOT_3 60 -#define WJR_PP_NOT_4 59 -#define WJR_PP_NOT_5 58 -#define WJR_PP_NOT_6 57 -#define WJR_PP_NOT_7 56 -#define WJR_PP_NOT_8 55 -#define WJR_PP_NOT_9 54 -#define WJR_PP_NOT_10 53 -#define WJR_PP_NOT_11 52 -#define WJR_PP_NOT_12 51 -#define WJR_PP_NOT_13 50 -#define WJR_PP_NOT_14 49 -#define WJR_PP_NOT_15 48 -#define WJR_PP_NOT_16 47 -#define WJR_PP_NOT_17 46 -#define WJR_PP_NOT_18 45 -#define WJR_PP_NOT_19 44 -#define WJR_PP_NOT_20 43 -#define WJR_PP_NOT_21 42 -#define WJR_PP_NOT_22 41 -#define WJR_PP_NOT_23 40 -#define WJR_PP_NOT_24 39 -#define WJR_PP_NOT_25 38 -#define WJR_PP_NOT_26 37 -#define WJR_PP_NOT_27 36 -#define WJR_PP_NOT_28 35 -#define WJR_PP_NOT_29 34 -#define WJR_PP_NOT_30 33 -#define WJR_PP_NOT_31 32 -#define WJR_PP_NOT_32 31 -#define WJR_PP_NOT_33 30 -#define WJR_PP_NOT_34 29 -#define WJR_PP_NOT_35 28 -#define WJR_PP_NOT_36 27 -#define WJR_PP_NOT_37 26 -#define WJR_PP_NOT_38 25 -#define WJR_PP_NOT_39 24 -#define WJR_PP_NOT_40 23 -#define WJR_PP_NOT_41 22 -#define WJR_PP_NOT_42 21 -#define WJR_PP_NOT_43 20 -#define WJR_PP_NOT_44 19 -#define WJR_PP_NOT_45 18 -#define WJR_PP_NOT_46 17 -#define WJR_PP_NOT_47 16 -#define WJR_PP_NOT_48 15 -#define WJR_PP_NOT_49 14 -#define WJR_PP_NOT_50 13 -#define WJR_PP_NOT_51 12 -#define WJR_PP_NOT_52 11 -#define WJR_PP_NOT_53 10 -#define WJR_PP_NOT_54 9 -#define WJR_PP_NOT_55 8 -#define WJR_PP_NOT_56 7 -#define WJR_PP_NOT_57 6 -#define WJR_PP_NOT_58 5 -#define WJR_PP_NOT_59 4 -#define WJR_PP_NOT_60 3 -#define WJR_PP_NOT_61 2 -#define WJR_PP_NOT_62 1 -#define WJR_PP_NOT_63 0 - -#endif // ! WJR_PREPROCESSOR_ARITHMATIC_NOT_HPP__ \ No newline at end of file diff --git a/include/wjr/preprocessor/arithmatic/sub.hpp b/include/wjr/preprocessor/arithmatic/sub.hpp index cfd756dd..86536926 100644 --- a/include/wjr/preprocessor/arithmatic/sub.hpp +++ b/include/wjr/preprocessor/arithmatic/sub.hpp @@ -5,6 +5,6 @@ #include #include -#define WJR_PP_SUB(x, y) WJR_PP_ADD(x, WJR_PP_INC(WJR_PP_NOT(y))) +#define WJR_PP_SUB(x, y) WJR_PP_ADD(x, WJR_PP_INC(WJR_PP_NEG(y))) #endif // ! WJR_PREPROCESSOR_ARITHMATIC_SUB_HPP__ \ No newline at end of file diff --git a/include/wjr/preprocessor/details/basic.hpp b/include/wjr/preprocessor/details/basic.hpp index e21204ad..ee779596 100644 --- a/include/wjr/preprocessor/details/basic.hpp +++ b/include/wjr/preprocessor/details/basic.hpp @@ -35,7 +35,8 @@ _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, _65, N, ...) \ N -#define WJR_PP_IS_NULLPTR(VAL) WJR_PP_IS_NULLPTR_I(WJR_PP_CONCAT(WJR_PP_IS_NULLPTR_, VAL), 0) +#define WJR_PP_IS_NULLPTR(VAL) \ + WJR_PP_IS_NULLPTR_I(WJR_PP_CONCAT(WJR_PP_IS_NULLPTR_, VAL), 0) #define WJR_PP_IS_NULLPTR_I(...) WJR_PP_IS_NULLPTR_II(__VA_ARGS__) #define WJR_PP_IS_NULLPTR_II(HOLDER, VAL, ...) VAL #define WJR_PP_IS_NULLPTR_WJR_PP_NULLPTR WJR_PP_HOLDER, 1 @@ -60,4 +61,13 @@ #define WJR_PP_FROM_VAR_II(HOLDER, VAL, ...) VAL #define WJR_PP_FROM_VAR_WJR_PP_FROM_VAR(VAR) WJR_PP_HOLDER, VAR +#define WJR_PP_PAREN () +#define WJR_PP_DEFER(FUNC) FUNC WJR_PP_PAREN + +#define WJR_PP_EXPAND4(x) WJR_PP_EXPAND(WJR_PP_EXPAND(WJR_PP_EXPAND(WJR_PP_EXPAND(x)))) +#define WJR_PP_EXPAND16(x) \ + WJR_PP_EXPAND4(WJR_PP_EXPAND4(WJR_PP_EXPAND4(WJR_PP_EXPAND4(x)))) +#define WJR_PP_EXPAND64(x) \ + WJR_PP_EXPAND16(WJR_PP_EXPAND16(WJR_PP_EXPAND16(WJR_PP_EXPAND16(x)))) + #endif // ! WJR_PREPROCESSOR_DETAILS_BASIC_HPP__ \ No newline at end of file