1 /* SPDX-License-Identifier: GPL-2.0 */
2 
3 /*
4  * Copyright (C) 2023 Google LLC.
5  */
6 
7 #ifndef __UNROLL_H
8 #define __UNROLL_H
9 
10 #include <linux/args.h>
11 
12 #define UNROLL(N, MACRO, args...) CONCATENATE(__UNROLL_, N)(MACRO, args)
13 
14 #define __UNROLL_0(MACRO, args...)
15 #define __UNROLL_1(MACRO, args...)  __UNROLL_0(MACRO, args)  MACRO(0, args)
16 #define __UNROLL_2(MACRO, args...)  __UNROLL_1(MACRO, args)  MACRO(1, args)
17 #define __UNROLL_3(MACRO, args...)  __UNROLL_2(MACRO, args)  MACRO(2, args)
18 #define __UNROLL_4(MACRO, args...)  __UNROLL_3(MACRO, args)  MACRO(3, args)
19 #define __UNROLL_5(MACRO, args...)  __UNROLL_4(MACRO, args)  MACRO(4, args)
20 #define __UNROLL_6(MACRO, args...)  __UNROLL_5(MACRO, args)  MACRO(5, args)
21 #define __UNROLL_7(MACRO, args...)  __UNROLL_6(MACRO, args)  MACRO(6, args)
22 #define __UNROLL_8(MACRO, args...)  __UNROLL_7(MACRO, args)  MACRO(7, args)
23 #define __UNROLL_9(MACRO, args...)  __UNROLL_8(MACRO, args)  MACRO(8, args)
24 #define __UNROLL_10(MACRO, args...) __UNROLL_9(MACRO, args)  MACRO(9, args)
25 #define __UNROLL_11(MACRO, args...) __UNROLL_10(MACRO, args) MACRO(10, args)
26 #define __UNROLL_12(MACRO, args...) __UNROLL_11(MACRO, args) MACRO(11, args)
27 #define __UNROLL_13(MACRO, args...) __UNROLL_12(MACRO, args) MACRO(12, args)
28 #define __UNROLL_14(MACRO, args...) __UNROLL_13(MACRO, args) MACRO(13, args)
29 #define __UNROLL_15(MACRO, args...) __UNROLL_14(MACRO, args) MACRO(14, args)
30 #define __UNROLL_16(MACRO, args...) __UNROLL_15(MACRO, args) MACRO(15, args)
31 #define __UNROLL_17(MACRO, args...) __UNROLL_16(MACRO, args) MACRO(16, args)
32 #define __UNROLL_18(MACRO, args...) __UNROLL_17(MACRO, args) MACRO(17, args)
33 #define __UNROLL_19(MACRO, args...) __UNROLL_18(MACRO, args) MACRO(18, args)
34 #define __UNROLL_20(MACRO, args...) __UNROLL_19(MACRO, args) MACRO(19, args)
35 
36 #endif /* __UNROLL_H */
37