History

Merge tag 'bitmap-6.0-rc1' of https://github.com/norov/linux

Pull bitmap updates from Yury Norov: - fix the duplicated comments on bitmap_to_arr64() (Qu Wenruo) - optimize out non-atomic bitops on compile-time constants (Alexander Lobakin) - cleanup bitmap-related headers (Yury Norov) - x86/olpc: fix 'logical not is only applied to the left hand side' (Alexander Lobakin) - lib/nodemask: inline wrappers around bitmap (Yury Norov) * tag 'bitmap-6.0-rc1' of https://github.com/norov/linux: (26 commits) lib/nodemask: inline next_node_in() and node_random() powerpc: drop dependency on <asm/machdep.h> in archrandom.h x86/olpc: fix 'logical not is only applied to the left hand side' lib/cpumask: move some one-line wrappers to header file headers/deps: mm: align MANITAINERS and Docs with new gfp.h structure headers/deps: mm: Split <linux/gfp_types.h> out of <linux/gfp.h> headers/deps: mm: Optimize <linux/gfp.h> header dependencies lib/cpumask: move trivial wrappers around find_bit to the header lib/cpumask: change return types to unsigned where appropriate cpumask: change return types to bool where appropriate lib/bitmap: change type of bitmap_weight to unsigned long lib/bitmap: change return types to bool where appropriate arm: align find_bit declarations with generic kernel iommu/vt-d: avoid invalid memory access via node_online(NUMA_NO_NODE) lib/test_bitmap: test the tail after bitmap_to_arr64() lib/bitmap: fix off-by-one in bitmap_to_arr64() lib: test_bitmap: add compile-time optimization/evaluations assertions bitmap: don't assume compiler evaluates small mem*() builtins calls net/ice: fix initializing the bitmap in the switch code bitops: let optimize out non-atomic bitops on compile-time constants ...

Linus Torvalds committed 4 years ago

Commit 4e23eee2 parents 3bc1bc0 36d4b3638 files · +1076 −789Browse files

Showing the changes to tools/include/linux (2 of 38 files). Show all

Unified · Split

2 files
  1. tools/include/linux/bitmap.h +6 −6
  2. tools/include/linux/bitops.h +16 −0
tools/include/linux/bitmap.h+6−6
@@ -11,10 +11,10 @@ · 10 unmodified lines
1111 #define DECLARE_BITMAP(name,bits) \
1212 unsigned long name[BITS_TO_LONGS(bits)]
1313
14−int __bitmap_weight(const unsigned long *bitmap, int bits);
14+unsigned int __bitmap_weight(const unsigned long *bitmap, int bits);
1515 void __bitmap_or(unsigned long *dst, const unsigned long *bitmap1,
1616 const unsigned long *bitmap2, int bits);
17−int __bitmap_and(unsigned long *dst, const unsigned long *bitmap1,
17+bool __bitmap_and(unsigned long *dst, const unsigned long *bitmap1,
1818 const unsigned long *bitmap2, unsigned int bits);
1919 bool __bitmap_equal(const unsigned long *bitmap1,
2020 const unsigned long *bitmap2, unsigned int bits);
@@ -45,7 +45,7 @@ static inline void bitmap_fill(unsigned long *dst, unsigned int nbits) · 24 unmodified lines
4545 dst[nlongs - 1] = BITMAP_LAST_WORD_MASK(nbits);
4646 }
4747
48−static inline int bitmap_empty(const unsigned long *src, unsigned nbits)
48+static inline bool bitmap_empty(const unsigned long *src, unsigned int nbits)
4949 {
5050 if (small_const_nbits(nbits))
5151 return ! (*src & BITMAP_LAST_WORD_MASK(nbits));
@@ -53,7 +53,7 @@ static inline int bitmap_empty(const unsigned long *src, unsigned nbits) · 1 unmodified line
5353 return find_first_bit(src, nbits) == nbits;
5454 }
5555
56−static inline int bitmap_full(const unsigned long *src, unsigned int nbits)
56+static inline bool bitmap_full(const unsigned long *src, unsigned int nbits)
5757 {
5858 if (small_const_nbits(nbits))
5959 return ! (~(*src) & BITMAP_LAST_WORD_MASK(nbits));
@@ -61,7 +61,7 @@ static inline int bitmap_full(const unsigned long *src, unsigned int nbits) · 1 unmodified line
6161 return find_first_zero_bit(src, nbits) == nbits;
6262 }
6363
64−static inline int bitmap_weight(const unsigned long *src, unsigned int nbits)
64+static inline unsigned int bitmap_weight(const unsigned long *src, unsigned int nbits)
6565 {
6666 if (small_const_nbits(nbits))
6767 return hweight_long(*src & BITMAP_LAST_WORD_MASK(nbits));
@@ -146,7 +146,7 @@ size_t bitmap_scnprintf(unsigned long *bitmap, unsigned int nbits, · 78 unmodified lines
146146 * @src2: operand 2
147147 * @nbits: size of bitmap
148148 */
149−static inline int bitmap_and(unsigned long *dst, const unsigned long *src1,
149+static inline bool bitmap_and(unsigned long *dst, const unsigned long *src1,
150150 const unsigned long *src2, unsigned int nbits)
151151 {
152152 if (small_const_nbits(nbits))
tools/include/linux/bitops.h+16−0
@@ -25,6 +25,22 @@ extern unsigned int __sw_hweight16(unsigned int w); · 24 unmodified lines
2525 extern unsigned int __sw_hweight32(unsigned int w);
2626 extern unsigned long __sw_hweight64(__u64 w);
2727
28+/*
29+ * Defined here because those may be needed by architecture-specific static
30+ * inlines.
31+ */
32+
33+#define bitop(op, nr, addr) \
34+ op(nr, addr)
35+
36+#define __set_bit(nr, addr) bitop(___set_bit, nr, addr)
37+#define __clear_bit(nr, addr) bitop(___clear_bit, nr, addr)
38+#define __change_bit(nr, addr) bitop(___change_bit, nr, addr)
39+#define __test_and_set_bit(nr, addr) bitop(___test_and_set_bit, nr, addr)
40+#define __test_and_clear_bit(nr, addr) bitop(___test_and_clear_bit, nr, addr)
41+#define __test_and_change_bit(nr, addr) bitop(___test_and_change_bit, nr, addr)
42+#define test_bit(nr, addr) bitop(_test_bit, nr, addr)
43+
2844 /*
2945 * Include this here because some architectures need generic_ffs/fls in
3046 * scope

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t