git: d4e236c70b0d - main - inline_ffs: remove backup binary implementation
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 06 Jul 2023 18:37:42 UTC
The branch main has been updated by dougm:
URL: https://cgit.FreeBSD.org/src/commit/?id=d4e236c70b0db52cd7232a11ad0a2ed895e65f70
commit d4e236c70b0db52cd7232a11ad0a2ed895e65f70
Author: Doug Moore <dougm@FreeBSD.org>
AuthorDate: 2023-07-06 18:36:12 +0000
Commit: Doug Moore <dougm@FreeBSD.org>
CommitDate: 2023-07-06 18:36:12 +0000
inline_ffs: remove backup binary implementation
There is no longer be any point to maintaining a binary search routine
for ffs; inlines will always do it as well or better.
Reviewed by: mhorne
Differential Revision: https://reviews.freebsd.org/D40703
---
sys/kern/subr_blist.c | 35 +++--------------------------------
1 file changed, 3 insertions(+), 32 deletions(-)
diff --git a/sys/kern/subr_blist.c b/sys/kern/subr_blist.c
index ba13fb4efd80..aa0ba6a88610 100644
--- a/sys/kern/subr_blist.c
+++ b/sys/kern/subr_blist.c
@@ -184,42 +184,13 @@ bitrange(int n, int count)
((u_daddr_t)-1 >> (BLIST_RADIX - (n + count))));
}
-/*
- * Find the first bit set in a u_daddr_t.
- */
-static inline int
-generic_bitpos(u_daddr_t mask)
-{
- int hi, lo, mid;
-
- lo = 0;
- hi = BLIST_RADIX;
- while (lo + 1 < hi) {
- mid = (lo + hi) >> 1;
- if (mask & bitrange(0, mid))
- hi = mid;
- else
- lo = mid;
- }
- return (lo);
-}
-
static inline int
bitpos(u_daddr_t mask)
{
- switch (sizeof(mask)) {
-#ifdef HAVE_INLINE_FFSLL
- case sizeof(long long):
- return (ffsll(mask) - 1);
-#endif
-#ifdef HAVE_INLINE_FFS
- case sizeof(int):
- return (ffs(mask) - 1);
-#endif
- default:
- return (generic_bitpos(mask));
- }
+ _Static_assert(sizeof(long long) >= sizeof(mask),
+ "mask too big for ffsll()");
+ return (ffsll(mask) - 1);
}
/*