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++;