| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * From lib/bitmap.c |
|---|
| 3 | 4 | * 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. |
|---|
| 7 | 5 | */ |
|---|
| 8 | 6 | #include <linux/bitmap.h> |
|---|
| 9 | 7 | |
|---|
| .. | .. |
|---|
| 73 | 71 | BITMAP_LAST_WORD_MASK(bits)); |
|---|
| 74 | 72 | return result != 0; |
|---|
| 75 | 73 | } |
|---|
| 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 | +} |
|---|