|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen staging] x86/bitops: adjust partial first word handling in __find_next{,_zero}_bit()
commit 0e6f9fbb8a7724e6cb73733a68a60b64f841ea61
Author: Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Mon Feb 23 08:43:29 2026 +0100
Commit: Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Mon Feb 23 08:43:29 2026 +0100
x86/bitops: adjust partial first word handling in __find_next{,_zero}_bit()
There's no need to subtract "bit" in what is passed to __scanbit(), as the
other bits are zero anyway after the shift (in __find_next_bit()) or can
be made so (in __find_next_zero_bit()) by flipping negation and shift. (We
actually leverage the same facts in find_next{,_zero}_bit() as well.) This
way in __scanbit() the TZCNT alternative can be engaged.
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
xen/arch/x86/bitops.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/xen/arch/x86/bitops.c b/xen/arch/x86/bitops.c
index 720ab32362..22cfb6d8ec 100644
--- a/xen/arch/x86/bitops.c
+++ b/xen/arch/x86/bitops.c
@@ -35,8 +35,8 @@ unsigned int __find_next_bit(
if ( bit != 0 )
{
/* Look for a bit in the first word. */
- set = __scanbit(*p >> bit, BITS_PER_LONG - bit);
- if ( set < (BITS_PER_LONG - bit) )
+ set = __scanbit(*p >> bit, BITS_PER_LONG);
+ if ( set < BITS_PER_LONG )
return (offset + set);
offset += BITS_PER_LONG - bit;
p++;
@@ -85,8 +85,8 @@ unsigned int __find_next_zero_bit(
if ( bit != 0 )
{
/* Look for zero in the first word. */
- set = __scanbit(~(*p >> bit), BITS_PER_LONG - bit);
- if ( set < (BITS_PER_LONG - bit) )
+ set = __scanbit(~*p >> bit, BITS_PER_LONG);
+ if ( set < BITS_PER_LONG )
return (offset + set);
offset += BITS_PER_LONG - bit;
p++;
--
generated by git-patchbot for /home/xen/git/xen.git#staging
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |