diff options
author | KP Singh <[email protected]> | 2024-08-16 17:43:05 +0200 |
---|---|---|
committer | Paul Moore <[email protected]> | 2024-08-20 14:05:33 -0400 |
commit | 7cff549daa67c7549c5a8688674cea2df8c2ec80 (patch) | |
tree | ac4d70deb0a47097651c7eb9615c59f693f31f5f /lib/crypto/mpi/mpi-sub-ui.c | |
parent | 77b644c39d6afc0b2985807c74d95335931f6403 (diff) |
kernel: Add helper macros for loop unrolling
This helps in easily initializing blocks of code (e.g. static calls and
keys).
UNROLL(N, MACRO, __VA_ARGS__) calls MACRO N times with the first
argument as the index of the iteration. This allows string pasting to
create unique tokens for variable names, function calls etc.
As an example:
#include <linux/unroll.h>
#define MACRO(N, a, b) \
int add_##N(int a, int b) \
{ \
return a + b + N; \
}
UNROLL(2, MACRO, x, y)
expands to:
int add_0(int x, int y)
{
return x + y + 0;
}
int add_1(int x, int y)
{
return x + y + 1;
}
Tested-by: Guenter Roeck <[email protected]>
Reviewed-by: Kees Cook <[email protected]>
Reviewed-by: Casey Schaufler <[email protected]>
Reviewed-by: John Johansen <[email protected]>
Acked-by: Jiri Olsa <[email protected]>
Acked-by: Song Liu <[email protected]>
Acked-by: Andrii Nakryiko <[email protected]>
Acked-by: Casey Schaufler <[email protected]>
Nacked-by: Tetsuo Handa <[email protected]>
Signed-off-by: KP Singh <[email protected]>
Signed-off-by: Paul Moore <[email protected]>
Diffstat (limited to 'lib/crypto/mpi/mpi-sub-ui.c')
0 files changed, 0 insertions, 0 deletions