lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 19 Nov 2015 10:31:54 +0800
From:	Jia He <hejianet@...il.com>
To:	linux-kernel@...r.kernel.org, linux-arch@...r.kernel.org
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Rasmus Villemoes <linux@...musvillemoes.dk>,
	Denys Vlasenko <dvlasenk@...hat.com>,
	Kyungmin Park <kyungmin.park@...sung.com>,
	Michal Nazarewicz <mina86@...a86.com>,
	Yury Norov <yury.norov@...il.com>, Tejun Heo <tj@...nel.org>,
	Martin Kepplinger <martink@...teo.de>,
	George Spelvin <linux@...izon.com>,
	Ingo Molnar <mingo@...nel.org>, Arnd Bergmann <arnd@...db.de>,
	Jia He <hejianet@...il.com>
Subject: [PATCH 3/3] linux/bitmap: Replace find_fisrt_{zero_}bit with the new lightweight api 

This is to replace find_fisrt_{zero_}bit with the new lightweight api 
all_bit_is_{one,zero} in bitmap_{full,empty}

Signed-off-by: Jia He <hejianet@...il.com>
---
 include/asm-generic/bitops/find.h | 3 +++
 include/linux/bitmap.h            | 4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/include/asm-generic/bitops/find.h b/include/asm-generic/bitops/find.h
index 998d4d5..1ec1d45 100644
--- a/include/asm-generic/bitops/find.h
+++ b/include/asm-generic/bitops/find.h
@@ -59,4 +59,7 @@ extern unsigned long find_first_zero_bit(const unsigned long *addr,
 
 #endif /* CONFIG_GENERIC_FIND_FIRST_BIT */
 
+extern unsigned int all_bit_is_one(const unsigned long *addr, unsigned size);
+extern unsigned int all_bit_is_zero(const unsigned long *addr, unsigned size);
+
 #endif /*_ASM_GENERIC_BITOPS_FIND_H_ */
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h
index 15524f6..8877a68 100644
--- a/include/linux/bitmap.h
+++ b/include/linux/bitmap.h
@@ -281,7 +281,7 @@ static inline int bitmap_empty(const unsigned long *src, unsigned nbits)
 	if (small_const_nbits(nbits))
 		return ! (*src & BITMAP_LAST_WORD_MASK(nbits));
 
-	return find_first_bit(src, nbits) == nbits;
+	return all_bit_is_zero(src, nbits);
 }
 
 static inline int bitmap_full(const unsigned long *src, unsigned int nbits)
@@ -289,7 +289,7 @@ static inline int bitmap_full(const unsigned long *src, unsigned int nbits)
 	if (small_const_nbits(nbits))
 		return ! (~(*src) & BITMAP_LAST_WORD_MASK(nbits));
 
-	return find_first_zero_bit(src, nbits) == nbits;
+	return all_bit_is_one(src, nbits);
 }
 
 static __always_inline int bitmap_weight(const unsigned long *src, unsigned int nbits)
-- 
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists