Date: Sat, 28 Sep 2024 21:26:50 GMT From: Doug Moore <dougm@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 3873b9a8b3a5 - main - mlx4: use is_power_of_2 Message-ID: <202409282126.48SLQoDD000594@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by dougm: URL: https://cgit.FreeBSD.org/src/commit/?id=3873b9a8b3a51731e5db92ab0c5c59797e416015 commit 3873b9a8b3a51731e5db92ab0c5c59797e416015 Author: Doug Moore <dougm@FreeBSD.org> AuthorDate: 2024-09-28 21:23:17 +0000 Commit: Doug Moore <dougm@FreeBSD.org> CommitDate: 2024-09-28 21:23:17 +0000 mlx4: use is_power_of_2 It's faster to use is_power_of_2 than it is to compute roundup_power_of_two and then compare. So do that. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D46838 --- sys/dev/mlx4/mlx4_core/mlx4_alloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/mlx4/mlx4_core/mlx4_alloc.c b/sys/dev/mlx4/mlx4_core/mlx4_alloc.c index dcf6204dfc1a..fa68625f5ab9 100644 --- a/sys/dev/mlx4/mlx4_core/mlx4_alloc.c +++ b/sys/dev/mlx4/mlx4_core/mlx4_alloc.c @@ -173,7 +173,7 @@ int mlx4_bitmap_init(struct mlx4_bitmap *bitmap, u32 num, u32 mask, u32 reserved_bot, u32 reserved_top) { /* num must be a power of 2 */ - if (num != roundup_pow_of_two(num)) + if (!is_power_of_2(num)) return -EINVAL; bitmap->last = 0;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202409282126.48SLQoDD000594>