xref: /linux/tools/testing/selftests/bpf/progs/loop4.c (revision 24168c5e6dfbdd5b414f048f47f75d64533296ca)
1 // SPDX-License-Identifier: GPL-2.0
2 // Copyright (c) 2019 Facebook
3 #include <linux/bpf.h>
4 #include <bpf/bpf_helpers.h>
5 
6 #include "bpf_compiler.h"
7 
8 char _license[] SEC("license") = "GPL";
9 
10 SEC("socket")
11 int combinations(volatile struct __sk_buff* skb)
12 {
13 	int ret = 0, i;
14 
15 	__pragma_loop_no_unroll
16 	for (i = 0; i < 20; i++)
17 		if (skb->len)
18 			ret |= 1 << i;
19 	return ret;
20 }
21