KVER macro - support 4.9.256+ kernel am: 30af4b5487
Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/1584754
MUST ONLY BE SUBMITTED BY AUTOMERGER
Change-Id: If1ff426bde32101f411769112f1594b915668e22
diff --git a/libbpf_android/include/bpf/BpfUtils.h b/libbpf_android/include/bpf/BpfUtils.h
index 413d3ff..9671b8a 100644
--- a/libbpf_android/include/bpf/BpfUtils.h
+++ b/libbpf_android/include/bpf/BpfUtils.h
@@ -37,7 +37,7 @@
int synchronizeKernelRCU();
int setrlimitForTest();
-#define KVER(a, b, c) ((a)*65536 + (b)*256 + (c))
+#define KVER(a, b, c) (((a) << 24) + ((b) << 16) + (c))
unsigned kernelVersion();
diff --git a/progs/include/bpf_helpers.h b/progs/include/bpf_helpers.h
index a45b6fb..075ea94 100644
--- a/progs/include/bpf_helpers.h
+++ b/progs/include/bpf_helpers.h
@@ -109,7 +109,7 @@
static unsigned long long (*bpf_get_smp_processor_id)(void) = (void*) BPF_FUNC_get_smp_processor_id;
#define KVER_NONE 0
-#define KVER(a, b, c) ((a)*65536 + (b)*256 + (c))
+#define KVER(a, b, c) (((a) << 24) + ((b) << 16) + (c))
#define KVER_INF 0xFFFFFFFF
#define DEFINE_BPF_PROG_KVER_RANGE_OPT(SECTION_NAME, prog_uid, prog_gid, the_prog, min_kv, max_kv, \