diff options
Diffstat (limited to 'lib/bitmap.c')
| -rw-r--r-- | lib/bitmap.c | 20 | 
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/bitmap.c b/lib/bitmap.c index bbe2589e8497..f9e834841e94 100644 --- a/lib/bitmap.c +++ b/lib/bitmap.c @@ -59,6 +59,26 @@ int __bitmap_equal(const unsigned long *bitmap1,  }  EXPORT_SYMBOL(__bitmap_equal); +bool __bitmap_or_equal(const unsigned long *bitmap1, +		       const unsigned long *bitmap2, +		       const unsigned long *bitmap3, +		       unsigned int bits) +{ +	unsigned int k, lim = bits / BITS_PER_LONG; +	unsigned long tmp; + +	for (k = 0; k < lim; ++k) { +		if ((bitmap1[k] | bitmap2[k]) != bitmap3[k]) +			return false; +	} + +	if (!(bits % BITS_PER_LONG)) +		return true; + +	tmp = (bitmap1[k] | bitmap2[k]) ^ bitmap3[k]; +	return (tmp & BITMAP_LAST_WORD_MASK(bits)) == 0; +} +  void __bitmap_complement(unsigned long *dst, const unsigned long *src, unsigned int bits)  {  	unsigned int k, lim = BITS_TO_LONGS(bits);  |