Skip to content

Commit 4784db5

Browse files
committed
sys: util: Add fast version of FOR_EACH_x, GET_ARG and GET_ARGS_LESS
Added version which compiles much faster and provide similar functionality (with few limitations). If macros are widely used then compile time is significantly shorter (order of magnitude). Signed-off-by: Krzysztof Chruscinski <[email protected]>
1 parent 6d7fb95 commit 4784db5

File tree

2 files changed

+466
-0
lines changed

2 files changed

+466
-0
lines changed

include/sys/util_internal.h

Lines changed: 382 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -773,4 +773,386 @@
773773
#define MACRO_MC_14(m, a, ...) UTIL_CAT(m(a), MACRO_MC_13(m, __VA_ARGS__,))
774774
#define MACRO_MC_15(m, a, ...) UTIL_CAT(m(a), MACRO_MC_14(m, __VA_ARGS__,))
775775

776+
#define Z_FAST_FOR_LOOP_GET_ARG(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, \
777+
_12, _13, _14, _15, _16, _17, _18, _19, _20, \
778+
_21, _22, _23, _24, _25, _26, _27, _28, _29, \
779+
_30, _31, _32, N, ...) N
780+
781+
#define Z_CBPRINTF_IS_PCHAR2(x) Z_CBPRINTF_IS_PCHAR(x) +
782+
783+
#define Z_FAST_FOR_LOOP_0(z_call, sep, fixed_arg0, fixed_arg1, ...)
784+
785+
#define Z_FAST_FOR_LOOP_1(z_call, sep, fixed_arg0, fixed_arg1, x) \
786+
z_call(0, x, fixed_arg0, fixed_arg1)
787+
788+
#define Z_FAST_FOR_LOOP_2(z_call, sep, fixed_arg0, fixed_arg1, x, ...) \
789+
z_call(1, x, fixed_arg0, fixed_arg1) __DEBRACKET sep \
790+
Z_FAST_FOR_LOOP_1(z_call, sep, fixed_arg0, fixed_arg1, ##__VA_ARGS__)
791+
792+
#define Z_FAST_FOR_LOOP_3(z_call, sep, fixed_arg0, fixed_arg1, x, ...) \
793+
z_call(2, x, fixed_arg0, fixed_arg1) __DEBRACKET sep \
794+
Z_FAST_FOR_LOOP_2(z_call, sep, fixed_arg0, fixed_arg1, ##__VA_ARGS__)
795+
796+
#define Z_FAST_FOR_LOOP_4(z_call, sep, fixed_arg0, fixed_arg1, x, ...) \
797+
z_call(3, x, fixed_arg0, fixed_arg1) __DEBRACKET sep \
798+
Z_FAST_FOR_LOOP_3(z_call, sep, fixed_arg0, fixed_arg1, ##__VA_ARGS__)
799+
800+
#define Z_FAST_FOR_LOOP_5(z_call, sep, fixed_arg0, fixed_arg1, x, ...) \
801+
z_call(4, x, fixed_arg0, fixed_arg1) __DEBRACKET sep \
802+
Z_FAST_FOR_LOOP_4(z_call, sep, fixed_arg0, fixed_arg1, ##__VA_ARGS__)
803+
804+
#define Z_FAST_FOR_LOOP_6(z_call, sep, fixed_arg0, fixed_arg1, x, ...) \
805+
z_call(5, x, fixed_arg0, fixed_arg1) __DEBRACKET sep \
806+
Z_FAST_FOR_LOOP_5(z_call, sep, fixed_arg0, fixed_arg1, ##__VA_ARGS__)
807+
808+
#define Z_FAST_FOR_LOOP_7(z_call, sep, fixed_arg0, fixed_arg1, x, ...) \
809+
z_call(6, x, fixed_arg0, fixed_arg1) __DEBRACKET sep \
810+
Z_FAST_FOR_LOOP_6(z_call, sep, fixed_arg0, fixed_arg1, ##__VA_ARGS__)
811+
812+
#define Z_FAST_FOR_LOOP_8(z_call, sep, fixed_arg0, fixed_arg1, x, ...) \
813+
z_call(7, x, fixed_arg0, fixed_arg1) __DEBRACKET sep \
814+
Z_FAST_FOR_LOOP_7(z_call, sep, fixed_arg0, fixed_arg1, ##__VA_ARGS__)
815+
816+
#define Z_FAST_FOR_LOOP_9(z_call, sep, fixed_arg0, fixed_arg1, x, ...) \
817+
z_call(8,x, fixed_arg0, fixed_arg1) __DEBRACKET sep \
818+
Z_FAST_FOR_LOOP_8(z_call, sep, fixed_arg0, fixed_arg1, ##__VA_ARGS__)
819+
820+
#define Z_FAST_FOR_LOOP_10(z_call, sep, fixed_arg0, fixed_arg1, x, ...) \
821+
z_call(9, x, fixed_arg0, fixed_arg1) __DEBRACKET sep \
822+
Z_FAST_FOR_LOOP_9(z_call, sep, fixed_arg0, fixed_arg1, ##__VA_ARGS__)
823+
824+
#define Z_FAST_FOR_LOOP_11(z_call, sep, fixed_arg0, fixed_arg1, x, ...) \
825+
z_call(10, x, fixed_arg0, fixed_arg1) __DEBRACKET sep \
826+
Z_FAST_FOR_LOOP_10(z_call, sep, fixed_arg0, fixed_arg1, ##__VA_ARGS__)
827+
828+
#define Z_FAST_FOR_LOOP_12(z_call, sep, fixed_arg0, fixed_arg1, x, ...) \
829+
z_call(11, x, fixed_arg0, fixed_arg1) __DEBRACKET sep \
830+
Z_FAST_FOR_LOOP_11(z_call, sep, fixed_arg0, fixed_arg1, ##__VA_ARGS__)
831+
832+
#define Z_FAST_FOR_LOOP_13(z_call, sep, fixed_arg0, fixed_arg1, x, ...) \
833+
z_call(12, x, fixed_arg0, fixed_arg1) __DEBRACKET sep \
834+
Z_FAST_FOR_LOOP_12(z_call, sep, fixed_arg0, fixed_arg1, ##__VA_ARGS__)
835+
836+
#define Z_FAST_FOR_LOOP_14(z_call, sep, fixed_arg0, fixed_arg1, x, ...) \
837+
z_call(13, x, fixed_arg0, fixed_arg1) __DEBRACKET sep \
838+
Z_FAST_FOR_LOOP_13(z_call, sep, fixed_arg0, fixed_arg1, ##__VA_ARGS__)
839+
840+
#define Z_FAST_FOR_LOOP_15(z_call, sep, fixed_arg0, fixed_arg1, x, ...) \
841+
z_call(14, x, fixed_arg0, fixed_arg1) __DEBRACKET sep \
842+
Z_FAST_FOR_LOOP_14(z_call, sep, fixed_arg0, fixed_arg1, ##__VA_ARGS__)
843+
844+
#define Z_FAST_FOR_LOOP_16(z_call, sep, fixed_arg0, fixed_arg1, x, ...) \
845+
z_call(15, x, fixed_arg0, fixed_arg1) __DEBRACKET sep \
846+
Z_FAST_FOR_LOOP_15(z_call, sep, fixed_arg0, fixed_arg1, ##__VA_ARGS__)
847+
848+
#define Z_FAST_FOR_LOOP_17(z_call, sep, fixed_arg0, fixed_arg1, x, ...) \
849+
z_call(16, x, fixed_arg0, fixed_arg1) __DEBRACKET sep \
850+
Z_FAST_FOR_LOOP_16(z_call, sep, fixed_arg0, fixed_arg1, ##__VA_ARGS__)
851+
852+
#define Z_FAST_FOR_LOOP_18(z_call, sep, fixed_arg0, fixed_arg1, x, ...) \
853+
z_call(17, x, fixed_arg0, fixed_arg1) __DEBRACKET sep \
854+
Z_FAST_FOR_LOOP_17(z_call, sep, fixed_arg0, fixed_arg1, ##__VA_ARGS__)
855+
856+
#define Z_FAST_FOR_LOOP_19(z_call, sep, fixed_arg0, fixed_arg1, x, ...) \
857+
z_call(18,x, fixed_arg0, fixed_arg1) __DEBRACKET sep \
858+
Z_FAST_FOR_LOOP_18(z_call, sep, fixed_arg0, fixed_arg1, ##__VA_ARGS__)
859+
860+
#define Z_FAST_FOR_LOOP_20(z_call, sep, fixed_arg0, fixed_arg1, x, ...) \
861+
z_call(19, x, fixed_arg0, fixed_arg1) __DEBRACKET sep \
862+
Z_FAST_FOR_LOOP_19(z_call, sep, fixed_arg0, fixed_arg1, ##__VA_ARGS__)
863+
864+
#define Z_FAST_FOR_LOOP_21(z_call, sep, fixed_arg0, fixed_arg1, x, ...) \
865+
z_call(20, x, fixed_arg0, fixed_arg1) __DEBRACKET sep \
866+
Z_FAST_FOR_LOOP_20(z_call, sep, fixed_arg0, fixed_arg1, ##__VA_ARGS__)
867+
868+
#define Z_FAST_FOR_LOOP_22(z_call, sep, fixed_arg0, fixed_arg1, x, ...) \
869+
z_call(21, x, fixed_arg0, fixed_arg1) __DEBRACKET sep \
870+
Z_FAST_FOR_LOOP_21(z_call, sep, fixed_arg0, fixed_arg1, ##__VA_ARGS__)
871+
872+
#define Z_FAST_FOR_LOOP_23(z_call, sep, fixed_arg0, fixed_arg1, x, ...) \
873+
z_call(22, x, fixed_arg0, fixed_arg1) __DEBRACKET sep \
874+
Z_FAST_FOR_LOOP_22(z_call, sep, fixed_arg0, fixed_arg1, ##__VA_ARGS__)
875+
876+
#define Z_FAST_FOR_LOOP_24(z_call, sep, fixed_arg0, fixed_arg1, x, ...) \
877+
z_call(23, x, fixed_arg0, fixed_arg1) __DEBRACKET sep \
878+
Z_FAST_FOR_LOOP_23(z_call, sep, fixed_arg0, fixed_arg1, ##__VA_ARGS__)
879+
880+
#define Z_FAST_FOR_LOOP_25(z_call, sep, fixed_arg0, fixed_arg1, x, ...) \
881+
z_call(24, x, fixed_arg0, fixed_arg1) __DEBRACKET sep \
882+
Z_FAST_FOR_LOOP_24(z_call, sep, fixed_arg0, fixed_arg1, ##__VA_ARGS__)
883+
884+
#define Z_FAST_FOR_LOOP_26(z_call, sep, fixed_arg0, fixed_arg1, x, ...) \
885+
z_call(25, x, fixed_arg0, fixed_arg1) __DEBRACKET sep \
886+
Z_FAST_FOR_LOOP_25(z_call, sep, fixed_arg0, fixed_arg1, ##__VA_ARGS__)
887+
888+
#define Z_FAST_FOR_LOOP_27(z_call, sep, fixed_arg0, fixed_arg1, x, ...) \
889+
z_call(26, x, fixed_arg0, fixed_arg1) __DEBRACKET sep \
890+
Z_FAST_FOR_LOOP_26(z_call, sep, fixed_arg0, fixed_arg1, ##__VA_ARGS__)
891+
892+
#define Z_FAST_FOR_LOOP_28(z_call, sep, fixed_arg0, fixed_arg1, x, ...) \
893+
z_call(27, x, fixed_arg0, fixed_arg1) __DEBRACKET sep \
894+
Z_FAST_FOR_LOOP_27(z_call, sep, fixed_arg0, fixed_arg1, ##__VA_ARGS__)
895+
896+
#define Z_FAST_FOR_LOOP_29(z_call, sep, fixed_arg0, fixed_arg1, x, ...) \
897+
z_call(28,x, fixed_arg0, fixed_arg1) __DEBRACKET sep \
898+
Z_FAST_FOR_LOOP_28(z_call, sep, fixed_arg0, fixed_arg1, ##__VA_ARGS__)
899+
900+
#define Z_FAST_FOR_LOOP_30(z_call, sep, fixed_arg0, fixed_arg1, x, ...) \
901+
z_call(29, x, fixed_arg0, fixed_arg1) __DEBRACKET sep \
902+
Z_FAST_FOR_LOOP_29(z_call, sep, fixed_arg0, fixed_arg1, ##__VA_ARGS__)
903+
904+
#define Z_FAST_FOR_LOOP_31(z_call, sep, fixed_arg0, fixed_arg1, x, ...) \
905+
z_call(30, x, fixed_arg0, fixed_arg1) __DEBRACKET sep \
906+
Z_FAST_FOR_LOOP_30(z_call, sep, fixed_arg0, fixed_arg1, ##__VA_ARGS__)
907+
908+
#define Z_FAST_FOR_LOOP_32(z_call, sep, fixed_arg0, fixed_arg1, x, ...) \
909+
z_call(31, x, fixed_arg0, fixed_arg1) __DEBRACKET sep \
910+
Z_FAST_FOR_LOOP_31(z_call, sep, fixed_arg0, fixed_arg1, ##__VA_ARGS__)
911+
912+
#define FAST_FOR_EACH_ENGINE(x, sep, fixed_arg0, fixed_arg1, ...) \
913+
Z_FAST_FOR_LOOP_GET_ARG(__VA_ARGS__, \
914+
Z_FAST_FOR_LOOP_32, Z_FAST_FOR_LOOP_31, \
915+
Z_FAST_FOR_LOOP_30, Z_FAST_FOR_LOOP_29, Z_FAST_FOR_LOOP_28, \
916+
Z_FAST_FOR_LOOP_27, Z_FAST_FOR_LOOP_26, Z_FAST_FOR_LOOP_25, \
917+
Z_FAST_FOR_LOOP_24, Z_FAST_FOR_LOOP_23, Z_FAST_FOR_LOOP_22, \
918+
Z_FAST_FOR_LOOP_21, Z_FAST_FOR_LOOP_20, Z_FAST_FOR_LOOP_19, \
919+
Z_FAST_FOR_LOOP_18, Z_FAST_FOR_LOOP_17, Z_FAST_FOR_LOOP_16, \
920+
Z_FAST_FOR_LOOP_15, Z_FAST_FOR_LOOP_14, Z_FAST_FOR_LOOP_13, \
921+
Z_FAST_FOR_LOOP_12, Z_FAST_FOR_LOOP_11, Z_FAST_FOR_LOOP_10, \
922+
Z_FAST_FOR_LOOP_9, Z_FAST_FOR_LOOP_8, Z_FAST_FOR_LOOP_7, \
923+
Z_FAST_FOR_LOOP_6, Z_FAST_FOR_LOOP_5, Z_FAST_FOR_LOOP_4, \
924+
Z_FAST_FOR_LOOP_3, Z_FAST_FOR_LOOP_2, Z_FAST_FOR_LOOP_1, \
925+
Z_FAST_FOR_LOOP_0)(x, sep, fixed_arg0, fixed_arg1, \
926+
##__VA_ARGS__)
927+
928+
#define Z_FAST_GET_ARG_1(_0, ...) _0
929+
930+
#define Z_FAST_GET_ARG_2(_0, _1, ...) _1
931+
932+
#define Z_FAST_GET_ARG_3(_0, _1, _2, ...) _2
933+
934+
#define Z_FAST_GET_ARG_4(_0, _1, _2, _3, ...) _3
935+
936+
#define Z_FAST_GET_ARG_5(_0, _1, _2, _3, _4, ...) _4
937+
938+
#define Z_FAST_GET_ARG_6(_0, _1, _2, _3, _4, _5, ...) _5
939+
940+
#define Z_FAST_GET_ARG_7(_0, _1, _2, _3, _4, _5, _6, ...) _6
941+
942+
#define Z_FAST_GET_ARG_8(_0, _1, _2, _3, _4, _5, _6, _7, ...) _7
943+
944+
#define Z_FAST_GET_ARG_9(_0, _1, _2, _3, _4, _5, _6, _7, _8, ...) _8
945+
946+
#define Z_FAST_GET_ARG_10(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, ...) _9
947+
948+
#define Z_FAST_GET_ARG_11(_0, _1, _2, _3, _4, _5, \
949+
_6, _7, _8, _9, _10, ...) _10
950+
951+
#define Z_FAST_GET_ARG_12(_0, _1, _2, _3, _4, _5, _6,\
952+
_7, _8, _9, _10, _11, ...) _11
953+
954+
#define Z_FAST_GET_ARG_13(_0, _1, _2, _3, _4, _5, _6, \
955+
_7, _8, _9, _10, _11, _12, ...) _12
956+
957+
#define Z_FAST_GET_ARG_14(_0, _1, _2, _3, _4, _5, _6, \
958+
_7, _8, _9, _10, _11, _12, _13, ...) _13
959+
960+
#define Z_FAST_GET_ARG_15(_0, _1, _2, _3, _4, _5, _6, _7, \
961+
_8, _9, _10, _11, _12, _13, _14, ...) _14
962+
963+
#define Z_FAST_GET_ARG_16(_0, _1, _2, _3, _4, _5, _6, _7, \
964+
_8, _9, _10, _11, _12, _13, _14, _15, ...) _15
965+
966+
#define Z_FAST_GET_ARG_17(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, \
967+
_11, _12, _13, _14, _15, _16, ...) _16
968+
969+
#define Z_FAST_GET_ARG_18(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, \
970+
_11, _12, _13, _14, _15, _16, _17, ...) _17
971+
972+
#define Z_FAST_GET_ARG_19(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, \
973+
_11, _12, _13, _14, _15, _16, _17, _18, ...) _18
974+
975+
#define Z_FAST_GET_ARG_20(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, \
976+
_11, _12, _13, _14, _15, _16, _17, _18, _19, \
977+
...) _19
978+
979+
#define Z_FAST_GET_ARG_21(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, \
980+
_11, _12, _13, _14, _15, _16, _17, _18, _19, \
981+
_20, ...) _20
982+
983+
#define Z_FAST_GET_ARG_22(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, \
984+
_11, _12, _13, _14, _15, _16, _17, _18, _19, \
985+
_20, _21, ...) _21
986+
987+
#define Z_FAST_GET_ARG_23(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, \
988+
_11, _12, _13, _14, _15, _16, _17, _18, _19, \
989+
_20, _21, _22, ...) _22
990+
991+
#define Z_FAST_GET_ARG_24(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, \
992+
_11, _12, _13, _14, _15, _16, _17, _18, _19, \
993+
_20, _21, _22, _23, ...) _23
994+
995+
#define Z_FAST_GET_ARG_25(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, \
996+
_11, _12, _13, _14, _15, _16, _17, _18, _19, \
997+
_20, _21, _22, _23, _24, ...) _24
998+
999+
#define Z_FAST_GET_ARG_26(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, \
1000+
_11, _12, _13, _14, _15, _16, _17, _18, _19, \
1001+
_20, _21, _22, _23, _24, _25, ...) _25
1002+
1003+
#define Z_FAST_GET_ARG_27(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, \
1004+
_11, _12, _13, _14, _15, _16, _17, _18, _19, \
1005+
_20, _21, _22, _23, _24, _25, _26, ...) _26
1006+
1007+
#define Z_FAST_GET_ARG_28(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, \
1008+
_11, _12, _13, _14, _15, _16, _17, _18, _19, \
1009+
_20, _21, _22, _23, _24, _25, _26, _27, ...) _27
1010+
1011+
#define Z_FAST_GET_ARG_29(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, \
1012+
_11, _12, _13, _14, _15, _16, _17, _18, _19, \
1013+
_20, _21, _22, _23, _24, _25, _26, _27, _28, \
1014+
...) _28
1015+
1016+
#define Z_FAST_GET_ARG_30(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, \
1017+
_11, _12, _13, _14, _15, _16, _17, _18, _19, \
1018+
_20, _21, _22, _23, _24, _25, _26, _27, _28, \
1019+
_29, ...) _29
1020+
1021+
#define Z_FAST_GET_ARG_31(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, \
1022+
_11, _12, _13, _14, _15, _16, _17, _18, _19, \
1023+
_20, _21, _22, _23, _24, _25, _26, _27, _28, \
1024+
_29, _30, ...) _30
1025+
1026+
#define Z_FAST_GET_ARG_32(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, \
1027+
_11, _12, _13, _14, _15, _16, _17, _18, _19, \
1028+
_20, _21, _22, _23, _24, _25, _26, _27, _28, \
1029+
_29, _30, _31, ...) _31
1030+
1031+
#define Z_FAST_GET_ARGS_LESS_0(...) __VA_ARGS__
1032+
1033+
#define Z_FAST_GET_ARGS_LESS_1(_0, ...) __VA_ARGS__
1034+
1035+
#define Z_FAST_GET_ARGS_LESS_2(_0, _1, ...) __VA_ARGS__
1036+
1037+
#define Z_FAST_GET_ARGS_LESS_3(_0, _1, _2, ...) __VA_ARGS__
1038+
1039+
#define Z_FAST_GET_ARGS_LESS_4(_0, _1, _2, _3, ...) __VA_ARGS__
1040+
1041+
#define Z_FAST_GET_ARGS_LESS_5(_0, _1, _2, _3, _4, ...) __VA_ARGS__
1042+
1043+
#define Z_FAST_GET_ARGS_LESS_6(_0, _1, _2, _3, _4, _5, ...) __VA_ARGS__
1044+
1045+
#define Z_FAST_GET_ARGS_LESS_7(_0, _1, _2, _3, _4, _5, _6, ...) __VA_ARGS__
1046+
1047+
#define Z_FAST_GET_ARGS_LESS_8(_0, _1, _2, _3, _4, _5, \
1048+
_6, _7, ...) __VA_ARGS__
1049+
1050+
#define Z_FAST_GET_ARGS_LESS_9(_0, _1, _2, _3, _4, _5, \
1051+
_6, _7, _8, ...) __VA_ARGS__
1052+
1053+
#define Z_FAST_GET_ARGS_LESS_10(_0, _1, _2, _3, _4, _5, \
1054+
_6, _7, _8, _9, ...) __VA_ARGS__
1055+
1056+
#define Z_FAST_GET_ARGS_LESS_11(_0, _1, _2, _3, _4, _5, \
1057+
_6, _7, _8, _9, _10, ...) __VA_ARGS__
1058+
1059+
#define Z_FAST_GET_ARGS_LESS_12(_0, _1, _2, _3, _4, _5, _6,\
1060+
_7, _8, _9, _10, _11, ...) __VA_ARGS__
1061+
1062+
#define Z_FAST_GET_ARGS_LESS_13(_0, _1, _2, _3, _4, _5, _6, \
1063+
_7, _8, _9, _10, _11, _12, ...) __VA_ARGS__
1064+
1065+
#define Z_FAST_GET_ARGS_LESS_14(_0, _1, _2, _3, _4, _5, _6, \
1066+
_7, _8, _9, _10, _11, _12, _13, \
1067+
...) __VA_ARGS__
1068+
1069+
#define Z_FAST_GET_ARGS_LESS_15(_0, _1, _2, _3, _4, _5, _6, _7, \
1070+
_8, _9, _10, _11, _12, _13, _14, \
1071+
...) __VA_ARGS__
1072+
1073+
#define Z_FAST_GET_ARGS_LESS_16(_0, _1, _2, _3, _4, _5, _6, _7, \
1074+
_8, _9, _10, _11, _12, _13, _14, _15, ...) \
1075+
__VA_ARGS__
1076+
1077+
#define Z_FAST_GET_ARGS_LESS_17(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, \
1078+
_11, _12, _13, _14, _15, _16, ...) __VA_ARGS__
1079+
1080+
#define Z_FAST_GET_ARGS_LESS_18(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, \
1081+
_11, _12, _13, _14, _15, _16, _17, ...) \
1082+
__VA_ARGS__
1083+
1084+
#define Z_FAST_GET_ARGS_LESS_19(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, \
1085+
_11, _12, _13, _14, _15, _16, _17, _18, ...) \
1086+
__VA_ARGS__
1087+
1088+
#define Z_FAST_GET_ARGS_LESS_20(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, \
1089+
_11, _12, _13, _14, _15, _16, _17, _18, _19, \
1090+
...) __VA_ARGS__
1091+
1092+
#define Z_FAST_GET_ARGS_LESS_21(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, \
1093+
_11, _12, _13, _14, _15, _16, _17, _18, _19, \
1094+
_20, ...) __VA_ARGS__
1095+
1096+
#define Z_FAST_GET_ARGS_LESS_22(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, \
1097+
_11, _12, _13, _14, _15, _16, _17, _18, _19, \
1098+
_20, _21, ...) __VA_ARGS__
1099+
1100+
#define Z_FAST_GET_ARGS_LESS_23(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, \
1101+
_11, _12, _13, _14, _15, _16, _17, _18, _19, \
1102+
_20, _21, _22, ...) __VA_ARGS__
1103+
1104+
#define Z_FAST_GET_ARGS_LESS_24(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, \
1105+
_11, _12, _13, _14, _15, _16, _17, _18, _19, \
1106+
_20, _21, _22, _23, ...) __VA_ARGS__
1107+
1108+
#define Z_FAST_GET_ARGS_LESS_25(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, \
1109+
_11, _12, _13, _14, _15, _16, _17, _18, _19, \
1110+
_20, _21, _22, _23, _24, ...) __VA_ARGS__
1111+
1112+
#define Z_FAST_GET_ARGS_LESS_26(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, \
1113+
_11, _12, _13, _14, _15, _16, _17, _18, _19, \
1114+
_20, _21, _22, _23, _24, _25, ...) __VA_ARGS__
1115+
1116+
#define Z_FAST_GET_ARGS_LESS_27(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, \
1117+
_11, _12, _13, _14, _15, _16, _17, _18, _19, \
1118+
_20, _21, _22, _23, _24, _25, _26, ...) \
1119+
__VA_ARGS__
1120+
1121+
#define Z_FAST_GET_ARGS_LESS_28(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, \
1122+
_11, _12, _13, _14, _15, _16, _17, _18, _19, \
1123+
_20, _21, _22, _23, _24, _25, _26, _27, \
1124+
...) __VA_ARGS__
1125+
1126+
#define Z_FAST_GET_ARGS_LESS_29(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, \
1127+
_11, _12, _13, _14, _15, _16, _17, _18, _19, \
1128+
_20, _21, _22, _23, _24, _25, _26, _27, _28, \
1129+
...) __VA_ARGS__
1130+
1131+
#define Z_FAST_GET_ARGS_LESS_30(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, \
1132+
_11, _12, _13, _14, _15, _16, _17, _18, _19, \
1133+
_20, _21, _22, _23, _24, _25, _26, _27, _28, \
1134+
_29, ...) __VA_ARGS__
1135+
1136+
#define Z_FAST_GET_ARGS_LESS_31(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, \
1137+
_11, _12, _13, _14, _15, _16, _17, _18, _19, \
1138+
_20, _21, _22, _23, _24, _25, _26, _27, _28, \
1139+
_29, _30, ...) __VA_ARGS__
1140+
1141+
#define Z_FAST_GET_ARGS_LESS_32(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, \
1142+
_11, _12, _13, _14, _15, _16, _17, _18, _19, \
1143+
_20, _21, _22, _23, _24, _25, _26, _27, _28, \
1144+
_29, _30, _31, ...) __VA_ARGS__
1145+
1146+
#define Z_FAST_FOR_EACH_IDX_FIXED_ARG(idx, x, fixed_arg0, fixed_arg1) \
1147+
fixed_arg0(idx, x, fixed_arg1)
1148+
1149+
#define Z_FAST_FOR_EACH_FIXED_ARG(idx, x, fixed_arg0, fixed_arg1) \
1150+
fixed_arg0(x, fixed_arg1)
1151+
1152+
#define Z_FAST_FOR_EACH_IDX(idx, x, fixed_arg0, fixed_arg1) \
1153+
fixed_arg0(idx, x)
1154+
1155+
#define Z_FAST_FOR_EACH(idx, x, fixed_arg0, fixed_arg1) \
1156+
fixed_arg0(x)
1157+
7761158
#endif /* ZEPHYR_INCLUDE_SYS_UTIL_INTERNAL_H_ */

0 commit comments

Comments
 (0)