diff options
author | Jiri Kosina <jkosina@suse.cz> | 2020-04-01 13:26:12 +0300 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2020-04-01 13:26:12 +0300 |
commit | c9f289701540baeef9ac7c9977d67a7259f404db (patch) | |
tree | ac3c29d41da02ac735c9a12da78905842fbccd2f /tools/lib/bitmap.c | |
parent | 0aac6f9aaae5fba08963651d2ce49930145e118f (diff) | |
parent | 910a7e89cec65efad254c947ce2bf8bf5b370962 (diff) | |
download | linux-c9f289701540baeef9ac7c9977d67a7259f404db.tar.xz |
Merge branch 'for-5.7/appleir' into for-linus
- small code cleanups in hid-appleir from Lucas Tanure
Diffstat (limited to 'tools/lib/bitmap.c')
-rw-r--r-- | tools/lib/bitmap.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tools/lib/bitmap.c b/tools/lib/bitmap.c index 38494782be06..5043747ef6c5 100644 --- a/tools/lib/bitmap.c +++ b/tools/lib/bitmap.c @@ -71,3 +71,18 @@ int __bitmap_and(unsigned long *dst, const unsigned long *bitmap1, BITMAP_LAST_WORD_MASK(bits)); return result != 0; } + +int __bitmap_equal(const unsigned long *bitmap1, + const unsigned long *bitmap2, unsigned int bits) +{ + unsigned int k, lim = bits/BITS_PER_LONG; + for (k = 0; k < lim; ++k) + if (bitmap1[k] != bitmap2[k]) + return 0; + + if (bits % BITS_PER_LONG) + if ((bitmap1[k] ^ bitmap2[k]) & BITMAP_LAST_WORD_MASK(bits)) + return 0; + + return 1; +} |