lkml.org 
[lkml]   [2022]   [Aug]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC PATCH v1 2/3] do not merge: Temporary fix for is_power_of_2.
Date
Signed-off-by: Francis Laniel <flaniel@linux.microsoft.com>
---
tools/lib/bpf/libbpf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index e89cc9c885b3..5d0e997c85ea 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -4945,7 +4945,7 @@ static void bpf_map__destroy(struct bpf_map *map);

static bool is_pow_of_2(size_t x)
{
- return x && (x & (x - 1));
+ return x && (x & (x - 1)) == 0;
}

static size_t adjust_ringbuf_sz(size_t sz)
--
2.25.1
\
 
 \ /
  Last update: 2022-08-10 19:20    [W:2.071 / U:0.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site