Skip to content

Commit

Permalink
save
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Nov 12, 2023
1 parent 417acba commit 849ab2a
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 75 deletions.
2 changes: 1 addition & 1 deletion include/wjr/preprocessor/arithmatic/cmp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
72 changes: 72 additions & 0 deletions include/wjr/preprocessor/arithmatic/neg.hpp
Original file line number Diff line number Diff line change
@@ -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__
72 changes: 0 additions & 72 deletions include/wjr/preprocessor/arithmatic/not.hpp

This file was deleted.

2 changes: 1 addition & 1 deletion include/wjr/preprocessor/arithmatic/sub.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
#include <wjr/preprocessor/arithmatic/inc.hpp>
#include <wjr/preprocessor/arithmatic/not.hpp>

#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__
12 changes: 11 additions & 1 deletion include/wjr/preprocessor/details/basic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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__

0 comments on commit 849ab2a

Please sign in to comment.