summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/bpf/progs/loop4.c
blob: 650859022771b580fbbc53c056ada3993e3e0567 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2019 Facebook
#include <linux/bpf.h>
#include "bpf_helpers.h"

char _license[] SEC("license") = "GPL";

SEC("socket")
int combinations(volatile struct __sk_buff* skb)
{
	int ret = 0, i;

#pragma nounroll
	for (i = 0; i < 20; i++)
		if (skb->len)
			ret |= 1 << i;
	return ret;
}