hc
2023-12-09 b22da3d8526a935aa31e086e63f60ff3246cb61c
kernel/tools/lib/bitmap.c
....@@ -1,9 +1,7 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * From lib/bitmap.c
34 * Helper functions for bitmap.h.
4
- *
5
- * This source code is licensed under the GNU General Public License,
6
- * Version 2. See the file COPYING for more details.
75 */
86 #include <linux/bitmap.h>
97
....@@ -73,3 +71,18 @@
7371 BITMAP_LAST_WORD_MASK(bits));
7472 return result != 0;
7573 }
74
+
75
+int __bitmap_equal(const unsigned long *bitmap1,
76
+ const unsigned long *bitmap2, unsigned int bits)
77
+{
78
+ unsigned int k, lim = bits/BITS_PER_LONG;
79
+ for (k = 0; k < lim; ++k)
80
+ if (bitmap1[k] != bitmap2[k])
81
+ return 0;
82
+
83
+ if (bits % BITS_PER_LONG)
84
+ if ((bitmap1[k] ^ bitmap2[k]) & BITMAP_LAST_WORD_MASK(bits))
85
+ return 0;
86
+
87
+ return 1;
88
+}