|
|
0a122b |
From 3995e6984ffbdd018622ab2f31b59aec78eea17c Mon Sep 17 00:00:00 2001
|
|
|
0a122b |
From: Juan Quintela <quintela@redhat.com>
|
|
|
0a122b |
Date: Tue, 14 Jan 2014 15:07:12 +0100
|
|
|
0a122b |
Subject: [PATCH 01/40] bitmap: use long as index
|
|
|
0a122b |
|
|
|
0a122b |
RH-Author: Juan Quintela <quintela@redhat.com>
|
|
|
0a122b |
Message-id: <1389712071-23303-2-git-send-email-quintela@redhat.com>
|
|
|
0a122b |
Patchwork-id: 56656
|
|
|
0a122b |
O-Subject: [RHEL7 qemu-kvm PATCH 01/40] bitmap: use long as index
|
|
|
0a122b |
Bugzilla: 997559
|
|
|
0a122b |
RH-Acked-by: Orit Wasserman <owasserm@redhat.com>
|
|
|
0a122b |
RH-Acked-by: Dr. David Alan Gilbert (git) <dgilbert@redhat.com>
|
|
|
0a122b |
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
0a122b |
|
|
|
0a122b |
Move index and size fields from int to long. We need that for
|
|
|
0a122b |
migration. long is 64 bits on sane architectures, and 32bits should
|
|
|
0a122b |
be enough on all the 32bits architectures.
|
|
|
0a122b |
|
|
|
0a122b |
Signed-off-by: Juan Quintela <quintela@redhat.com>
|
|
|
0a122b |
Reviewed-by: Eric Blake <eblake@redhat.com>
|
|
|
0a122b |
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
|
|
|
0a122b |
(cherry picked from commit 9c22687ea8c1a2644a41a683ff0a291adc9a657c)
|
|
|
0a122b |
Signed-off-by: Juan Quintela <quintela@trasno.org>
|
|
|
0a122b |
---
|
|
|
0a122b |
include/qemu/bitmap.h | 77 ++++++++++++++++++++++++++-------------------------
|
|
|
0a122b |
include/qemu/bitops.h | 14 +++++-----
|
|
|
0a122b |
util/bitmap.c | 60 +++++++++++++++++++--------------------
|
|
|
0a122b |
3 files changed, 76 insertions(+), 75 deletions(-)
|
|
|
0a122b |
|
|
|
0a122b |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
0a122b |
---
|
|
|
0a122b |
include/qemu/bitmap.h | 77 +++++++++++++++++++++++++------------------------
|
|
|
0a122b |
include/qemu/bitops.h | 14 ++++----
|
|
|
0a122b |
util/bitmap.c | 60 +++++++++++++++++++-------------------
|
|
|
0a122b |
3 files changed, 76 insertions(+), 75 deletions(-)
|
|
|
0a122b |
|
|
|
0a122b |
diff --git a/include/qemu/bitmap.h b/include/qemu/bitmap.h
|
|
|
0a122b |
index 308bbb7..afdd257 100644
|
|
|
0a122b |
--- a/include/qemu/bitmap.h
|
|
|
0a122b |
+++ b/include/qemu/bitmap.h
|
|
|
0a122b |
@@ -31,7 +31,7 @@
|
|
|
0a122b |
* bitmap_andnot(dst, src1, src2, nbits) *dst = *src1 & ~(*src2)
|
|
|
0a122b |
* bitmap_complement(dst, src, nbits) *dst = ~(*src)
|
|
|
0a122b |
* bitmap_equal(src1, src2, nbits) Are *src1 and *src2 equal?
|
|
|
0a122b |
- * bitmap_intersects(src1, src2, nbits) Do *src1 and *src2 overlap?
|
|
|
0a122b |
+ * bitmap_intersects(src1, src2, nbits) Do *src1 and *src2 overlap?
|
|
|
0a122b |
* bitmap_empty(src, nbits) Are all bits zero in *src?
|
|
|
0a122b |
* bitmap_full(src, nbits) Are all bits set in *src?
|
|
|
0a122b |
* bitmap_set(dst, pos, nbits) Set specified bit area
|
|
|
0a122b |
@@ -62,71 +62,71 @@
|
|
|
0a122b |
)
|
|
|
0a122b |
|
|
|
0a122b |
#define DECLARE_BITMAP(name,bits) \
|
|
|
0a122b |
- unsigned long name[BITS_TO_LONGS(bits)]
|
|
|
0a122b |
+ unsigned long name[BITS_TO_LONGS(bits)]
|
|
|
0a122b |
|
|
|
0a122b |
#define small_nbits(nbits) \
|
|
|
0a122b |
- ((nbits) <= BITS_PER_LONG)
|
|
|
0a122b |
+ ((nbits) <= BITS_PER_LONG)
|
|
|
0a122b |
|
|
|
0a122b |
-int slow_bitmap_empty(const unsigned long *bitmap, int bits);
|
|
|
0a122b |
-int slow_bitmap_full(const unsigned long *bitmap, int bits);
|
|
|
0a122b |
+int slow_bitmap_empty(const unsigned long *bitmap, long bits);
|
|
|
0a122b |
+int slow_bitmap_full(const unsigned long *bitmap, long bits);
|
|
|
0a122b |
int slow_bitmap_equal(const unsigned long *bitmap1,
|
|
|
0a122b |
- const unsigned long *bitmap2, int bits);
|
|
|
0a122b |
+ const unsigned long *bitmap2, long bits);
|
|
|
0a122b |
void slow_bitmap_complement(unsigned long *dst, const unsigned long *src,
|
|
|
0a122b |
- int bits);
|
|
|
0a122b |
+ long bits);
|
|
|
0a122b |
void slow_bitmap_shift_right(unsigned long *dst,
|
|
|
0a122b |
- const unsigned long *src, int shift, int bits);
|
|
|
0a122b |
+ const unsigned long *src, int shift, long bits);
|
|
|
0a122b |
void slow_bitmap_shift_left(unsigned long *dst,
|
|
|
0a122b |
- const unsigned long *src, int shift, int bits);
|
|
|
0a122b |
+ const unsigned long *src, int shift, long bits);
|
|
|
0a122b |
int slow_bitmap_and(unsigned long *dst, const unsigned long *bitmap1,
|
|
|
0a122b |
- const unsigned long *bitmap2, int bits);
|
|
|
0a122b |
+ const unsigned long *bitmap2, long bits);
|
|
|
0a122b |
void slow_bitmap_or(unsigned long *dst, const unsigned long *bitmap1,
|
|
|
0a122b |
- const unsigned long *bitmap2, int bits);
|
|
|
0a122b |
+ const unsigned long *bitmap2, long bits);
|
|
|
0a122b |
void slow_bitmap_xor(unsigned long *dst, const unsigned long *bitmap1,
|
|
|
0a122b |
- const unsigned long *bitmap2, int bits);
|
|
|
0a122b |
+ const unsigned long *bitmap2, long bits);
|
|
|
0a122b |
int slow_bitmap_andnot(unsigned long *dst, const unsigned long *bitmap1,
|
|
|
0a122b |
- const unsigned long *bitmap2, int bits);
|
|
|
0a122b |
+ const unsigned long *bitmap2, long bits);
|
|
|
0a122b |
int slow_bitmap_intersects(const unsigned long *bitmap1,
|
|
|
0a122b |
- const unsigned long *bitmap2, int bits);
|
|
|
0a122b |
+ const unsigned long *bitmap2, long bits);
|
|
|
0a122b |
|
|
|
0a122b |
-static inline unsigned long *bitmap_new(int nbits)
|
|
|
0a122b |
+static inline unsigned long *bitmap_new(long nbits)
|
|
|
0a122b |
{
|
|
|
0a122b |
- int len = BITS_TO_LONGS(nbits) * sizeof(unsigned long);
|
|
|
0a122b |
+ long len = BITS_TO_LONGS(nbits) * sizeof(unsigned long);
|
|
|
0a122b |
return g_malloc0(len);
|
|
|
0a122b |
}
|
|
|
0a122b |
|
|
|
0a122b |
-static inline void bitmap_zero(unsigned long *dst, int nbits)
|
|
|
0a122b |
+static inline void bitmap_zero(unsigned long *dst, long nbits)
|
|
|
0a122b |
{
|
|
|
0a122b |
if (small_nbits(nbits)) {
|
|
|
0a122b |
*dst = 0UL;
|
|
|
0a122b |
} else {
|
|
|
0a122b |
- int len = BITS_TO_LONGS(nbits) * sizeof(unsigned long);
|
|
|
0a122b |
+ long len = BITS_TO_LONGS(nbits) * sizeof(unsigned long);
|
|
|
0a122b |
memset(dst, 0, len);
|
|
|
0a122b |
}
|
|
|
0a122b |
}
|
|
|
0a122b |
|
|
|
0a122b |
-static inline void bitmap_fill(unsigned long *dst, int nbits)
|
|
|
0a122b |
+static inline void bitmap_fill(unsigned long *dst, long nbits)
|
|
|
0a122b |
{
|
|
|
0a122b |
size_t nlongs = BITS_TO_LONGS(nbits);
|
|
|
0a122b |
if (!small_nbits(nbits)) {
|
|
|
0a122b |
- int len = (nlongs - 1) * sizeof(unsigned long);
|
|
|
0a122b |
+ long len = (nlongs - 1) * sizeof(unsigned long);
|
|
|
0a122b |
memset(dst, 0xff, len);
|
|
|
0a122b |
}
|
|
|
0a122b |
dst[nlongs - 1] = BITMAP_LAST_WORD_MASK(nbits);
|
|
|
0a122b |
}
|
|
|
0a122b |
|
|
|
0a122b |
static inline void bitmap_copy(unsigned long *dst, const unsigned long *src,
|
|
|
0a122b |
- int nbits)
|
|
|
0a122b |
+ long nbits)
|
|
|
0a122b |
{
|
|
|
0a122b |
if (small_nbits(nbits)) {
|
|
|
0a122b |
*dst = *src;
|
|
|
0a122b |
} else {
|
|
|
0a122b |
- int len = BITS_TO_LONGS(nbits) * sizeof(unsigned long);
|
|
|
0a122b |
+ long len = BITS_TO_LONGS(nbits) * sizeof(unsigned long);
|
|
|
0a122b |
memcpy(dst, src, len);
|
|
|
0a122b |
}
|
|
|
0a122b |
}
|
|
|
0a122b |
|
|
|
0a122b |
static inline int bitmap_and(unsigned long *dst, const unsigned long *src1,
|
|
|
0a122b |
- const unsigned long *src2, int nbits)
|
|
|
0a122b |
+ const unsigned long *src2, long nbits)
|
|
|
0a122b |
{
|
|
|
0a122b |
if (small_nbits(nbits)) {
|
|
|
0a122b |
return (*dst = *src1 & *src2) != 0;
|
|
|
0a122b |
@@ -135,7 +135,7 @@ static inline int bitmap_and(unsigned long *dst, const unsigned long *src1,
|
|
|
0a122b |
}
|
|
|
0a122b |
|
|
|
0a122b |
static inline void bitmap_or(unsigned long *dst, const unsigned long *src1,
|
|
|
0a122b |
- const unsigned long *src2, int nbits)
|
|
|
0a122b |
+ const unsigned long *src2, long nbits)
|
|
|
0a122b |
{
|
|
|
0a122b |
if (small_nbits(nbits)) {
|
|
|
0a122b |
*dst = *src1 | *src2;
|
|
|
0a122b |
@@ -145,7 +145,7 @@ static inline void bitmap_or(unsigned long *dst, const unsigned long *src1,
|
|
|
0a122b |
}
|
|
|
0a122b |
|
|
|
0a122b |
static inline void bitmap_xor(unsigned long *dst, const unsigned long *src1,
|
|
|
0a122b |
- const unsigned long *src2, int nbits)
|
|
|
0a122b |
+ const unsigned long *src2, long nbits)
|
|
|
0a122b |
{
|
|
|
0a122b |
if (small_nbits(nbits)) {
|
|
|
0a122b |
*dst = *src1 ^ *src2;
|
|
|
0a122b |
@@ -155,7 +155,7 @@ static inline void bitmap_xor(unsigned long *dst, const unsigned long *src1,
|
|
|
0a122b |
}
|
|
|
0a122b |
|
|
|
0a122b |
static inline int bitmap_andnot(unsigned long *dst, const unsigned long *src1,
|
|
|
0a122b |
- const unsigned long *src2, int nbits)
|
|
|
0a122b |
+ const unsigned long *src2, long nbits)
|
|
|
0a122b |
{
|
|
|
0a122b |
if (small_nbits(nbits)) {
|
|
|
0a122b |
return (*dst = *src1 & ~(*src2)) != 0;
|
|
|
0a122b |
@@ -163,8 +163,9 @@ static inline int bitmap_andnot(unsigned long *dst, const unsigned long *src1,
|
|
|
0a122b |
return slow_bitmap_andnot(dst, src1, src2, nbits);
|
|
|
0a122b |
}
|
|
|
0a122b |
|
|
|
0a122b |
-static inline void bitmap_complement(unsigned long *dst, const unsigned long *src,
|
|
|
0a122b |
- int nbits)
|
|
|
0a122b |
+static inline void bitmap_complement(unsigned long *dst,
|
|
|
0a122b |
+ const unsigned long *src,
|
|
|
0a122b |
+ long nbits)
|
|
|
0a122b |
{
|
|
|
0a122b |
if (small_nbits(nbits)) {
|
|
|
0a122b |
*dst = ~(*src) & BITMAP_LAST_WORD_MASK(nbits);
|
|
|
0a122b |
@@ -174,7 +175,7 @@ static inline void bitmap_complement(unsigned long *dst, const unsigned long *sr
|
|
|
0a122b |
}
|
|
|
0a122b |
|
|
|
0a122b |
static inline int bitmap_equal(const unsigned long *src1,
|
|
|
0a122b |
- const unsigned long *src2, int nbits)
|
|
|
0a122b |
+ const unsigned long *src2, long nbits)
|
|
|
0a122b |
{
|
|
|
0a122b |
if (small_nbits(nbits)) {
|
|
|
0a122b |
return ! ((*src1 ^ *src2) & BITMAP_LAST_WORD_MASK(nbits));
|
|
|
0a122b |
@@ -183,7 +184,7 @@ static inline int bitmap_equal(const unsigned long *src1,
|
|
|
0a122b |
}
|
|
|
0a122b |
}
|
|
|
0a122b |
|
|
|
0a122b |
-static inline int bitmap_empty(const unsigned long *src, int nbits)
|
|
|
0a122b |
+static inline int bitmap_empty(const unsigned long *src, long nbits)
|
|
|
0a122b |
{
|
|
|
0a122b |
if (small_nbits(nbits)) {
|
|
|
0a122b |
return ! (*src & BITMAP_LAST_WORD_MASK(nbits));
|
|
|
0a122b |
@@ -192,7 +193,7 @@ static inline int bitmap_empty(const unsigned long *src, int nbits)
|
|
|
0a122b |
}
|
|
|
0a122b |
}
|
|
|
0a122b |
|
|
|
0a122b |
-static inline int bitmap_full(const unsigned long *src, int nbits)
|
|
|
0a122b |
+static inline int bitmap_full(const unsigned long *src, long nbits)
|
|
|
0a122b |
{
|
|
|
0a122b |
if (small_nbits(nbits)) {
|
|
|
0a122b |
return ! (~(*src) & BITMAP_LAST_WORD_MASK(nbits));
|
|
|
0a122b |
@@ -202,7 +203,7 @@ static inline int bitmap_full(const unsigned long *src, int nbits)
|
|
|
0a122b |
}
|
|
|
0a122b |
|
|
|
0a122b |
static inline int bitmap_intersects(const unsigned long *src1,
|
|
|
0a122b |
- const unsigned long *src2, int nbits)
|
|
|
0a122b |
+ const unsigned long *src2, long nbits)
|
|
|
0a122b |
{
|
|
|
0a122b |
if (small_nbits(nbits)) {
|
|
|
0a122b |
return ((*src1 & *src2) & BITMAP_LAST_WORD_MASK(nbits)) != 0;
|
|
|
0a122b |
@@ -211,12 +212,12 @@ static inline int bitmap_intersects(const unsigned long *src1,
|
|
|
0a122b |
}
|
|
|
0a122b |
}
|
|
|
0a122b |
|
|
|
0a122b |
-void bitmap_set(unsigned long *map, int i, int len);
|
|
|
0a122b |
-void bitmap_clear(unsigned long *map, int start, int nr);
|
|
|
0a122b |
+void bitmap_set(unsigned long *map, long i, long len);
|
|
|
0a122b |
+void bitmap_clear(unsigned long *map, long start, long nr);
|
|
|
0a122b |
unsigned long bitmap_find_next_zero_area(unsigned long *map,
|
|
|
0a122b |
- unsigned long size,
|
|
|
0a122b |
- unsigned long start,
|
|
|
0a122b |
- unsigned int nr,
|
|
|
0a122b |
- unsigned long align_mask);
|
|
|
0a122b |
+ unsigned long size,
|
|
|
0a122b |
+ unsigned long start,
|
|
|
0a122b |
+ unsigned long nr,
|
|
|
0a122b |
+ unsigned long align_mask);
|
|
|
0a122b |
|
|
|
0a122b |
#endif /* BITMAP_H */
|
|
|
0a122b |
diff --git a/include/qemu/bitops.h b/include/qemu/bitops.h
|
|
|
0a122b |
index affcc96..5866115 100644
|
|
|
0a122b |
--- a/include/qemu/bitops.h
|
|
|
0a122b |
+++ b/include/qemu/bitops.h
|
|
|
0a122b |
@@ -28,7 +28,7 @@
|
|
|
0a122b |
* @nr: the bit to set
|
|
|
0a122b |
* @addr: the address to start counting from
|
|
|
0a122b |
*/
|
|
|
0a122b |
-static inline void set_bit(int nr, unsigned long *addr)
|
|
|
0a122b |
+static inline void set_bit(long nr, unsigned long *addr)
|
|
|
0a122b |
{
|
|
|
0a122b |
unsigned long mask = BIT_MASK(nr);
|
|
|
0a122b |
unsigned long *p = addr + BIT_WORD(nr);
|
|
|
0a122b |
@@ -41,7 +41,7 @@ static inline void set_bit(int nr, unsigned long *addr)
|
|
|
0a122b |
* @nr: Bit to clear
|
|
|
0a122b |
* @addr: Address to start counting from
|
|
|
0a122b |
*/
|
|
|
0a122b |
-static inline void clear_bit(int nr, unsigned long *addr)
|
|
|
0a122b |
+static inline void clear_bit(long nr, unsigned long *addr)
|
|
|
0a122b |
{
|
|
|
0a122b |
unsigned long mask = BIT_MASK(nr);
|
|
|
0a122b |
unsigned long *p = addr + BIT_WORD(nr);
|
|
|
0a122b |
@@ -54,7 +54,7 @@ static inline void clear_bit(int nr, unsigned long *addr)
|
|
|
0a122b |
* @nr: Bit to change
|
|
|
0a122b |
* @addr: Address to start counting from
|
|
|
0a122b |
*/
|
|
|
0a122b |
-static inline void change_bit(int nr, unsigned long *addr)
|
|
|
0a122b |
+static inline void change_bit(long nr, unsigned long *addr)
|
|
|
0a122b |
{
|
|
|
0a122b |
unsigned long mask = BIT_MASK(nr);
|
|
|
0a122b |
unsigned long *p = addr + BIT_WORD(nr);
|
|
|
0a122b |
@@ -67,7 +67,7 @@ static inline void change_bit(int nr, unsigned long *addr)
|
|
|
0a122b |
* @nr: Bit to set
|
|
|
0a122b |
* @addr: Address to count from
|
|
|
0a122b |
*/
|
|
|
0a122b |
-static inline int test_and_set_bit(int nr, unsigned long *addr)
|
|
|
0a122b |
+static inline int test_and_set_bit(long nr, unsigned long *addr)
|
|
|
0a122b |
{
|
|
|
0a122b |
unsigned long mask = BIT_MASK(nr);
|
|
|
0a122b |
unsigned long *p = addr + BIT_WORD(nr);
|
|
|
0a122b |
@@ -82,7 +82,7 @@ static inline int test_and_set_bit(int nr, unsigned long *addr)
|
|
|
0a122b |
* @nr: Bit to clear
|
|
|
0a122b |
* @addr: Address to count from
|
|
|
0a122b |
*/
|
|
|
0a122b |
-static inline int test_and_clear_bit(int nr, unsigned long *addr)
|
|
|
0a122b |
+static inline int test_and_clear_bit(long nr, unsigned long *addr)
|
|
|
0a122b |
{
|
|
|
0a122b |
unsigned long mask = BIT_MASK(nr);
|
|
|
0a122b |
unsigned long *p = addr + BIT_WORD(nr);
|
|
|
0a122b |
@@ -97,7 +97,7 @@ static inline int test_and_clear_bit(int nr, unsigned long *addr)
|
|
|
0a122b |
* @nr: Bit to change
|
|
|
0a122b |
* @addr: Address to count from
|
|
|
0a122b |
*/
|
|
|
0a122b |
-static inline int test_and_change_bit(int nr, unsigned long *addr)
|
|
|
0a122b |
+static inline int test_and_change_bit(long nr, unsigned long *addr)
|
|
|
0a122b |
{
|
|
|
0a122b |
unsigned long mask = BIT_MASK(nr);
|
|
|
0a122b |
unsigned long *p = addr + BIT_WORD(nr);
|
|
|
0a122b |
@@ -112,7 +112,7 @@ static inline int test_and_change_bit(int nr, unsigned long *addr)
|
|
|
0a122b |
* @nr: bit number to test
|
|
|
0a122b |
* @addr: Address to start counting from
|
|
|
0a122b |
*/
|
|
|
0a122b |
-static inline int test_bit(int nr, const unsigned long *addr)
|
|
|
0a122b |
+static inline int test_bit(long nr, const unsigned long *addr)
|
|
|
0a122b |
{
|
|
|
0a122b |
return 1UL & (addr[BIT_WORD(nr)] >> (nr & (BITS_PER_LONG-1)));
|
|
|
0a122b |
}
|
|
|
0a122b |
diff --git a/util/bitmap.c b/util/bitmap.c
|
|
|
0a122b |
index 687841d..9c6bb52 100644
|
|
|
0a122b |
--- a/util/bitmap.c
|
|
|
0a122b |
+++ b/util/bitmap.c
|
|
|
0a122b |
@@ -36,9 +36,9 @@
|
|
|
0a122b |
* endian architectures.
|
|
|
0a122b |
*/
|
|
|
0a122b |
|
|
|
0a122b |
-int slow_bitmap_empty(const unsigned long *bitmap, int bits)
|
|
|
0a122b |
+int slow_bitmap_empty(const unsigned long *bitmap, long bits)
|
|
|
0a122b |
{
|
|
|
0a122b |
- int k, lim = bits/BITS_PER_LONG;
|
|
|
0a122b |
+ long k, lim = bits/BITS_PER_LONG;
|
|
|
0a122b |
|
|
|
0a122b |
for (k = 0; k < lim; ++k) {
|
|
|
0a122b |
if (bitmap[k]) {
|
|
|
0a122b |
@@ -54,9 +54,9 @@ int slow_bitmap_empty(const unsigned long *bitmap, int bits)
|
|
|
0a122b |
return 1;
|
|
|
0a122b |
}
|
|
|
0a122b |
|
|
|
0a122b |
-int slow_bitmap_full(const unsigned long *bitmap, int bits)
|
|
|
0a122b |
+int slow_bitmap_full(const unsigned long *bitmap, long bits)
|
|
|
0a122b |
{
|
|
|
0a122b |
- int k, lim = bits/BITS_PER_LONG;
|
|
|
0a122b |
+ long k, lim = bits/BITS_PER_LONG;
|
|
|
0a122b |
|
|
|
0a122b |
for (k = 0; k < lim; ++k) {
|
|
|
0a122b |
if (~bitmap[k]) {
|
|
|
0a122b |
@@ -74,9 +74,9 @@ int slow_bitmap_full(const unsigned long *bitmap, int bits)
|
|
|
0a122b |
}
|
|
|
0a122b |
|
|
|
0a122b |
int slow_bitmap_equal(const unsigned long *bitmap1,
|
|
|
0a122b |
- const unsigned long *bitmap2, int bits)
|
|
|
0a122b |
+ const unsigned long *bitmap2, long bits)
|
|
|
0a122b |
{
|
|
|
0a122b |
- int k, lim = bits/BITS_PER_LONG;
|
|
|
0a122b |
+ long k, lim = bits/BITS_PER_LONG;
|
|
|
0a122b |
|
|
|
0a122b |
for (k = 0; k < lim; ++k) {
|
|
|
0a122b |
if (bitmap1[k] != bitmap2[k]) {
|
|
|
0a122b |
@@ -94,9 +94,9 @@ int slow_bitmap_equal(const unsigned long *bitmap1,
|
|
|
0a122b |
}
|
|
|
0a122b |
|
|
|
0a122b |
void slow_bitmap_complement(unsigned long *dst, const unsigned long *src,
|
|
|
0a122b |
- int bits)
|
|
|
0a122b |
+ long bits)
|
|
|
0a122b |
{
|
|
|
0a122b |
- int k, lim = bits/BITS_PER_LONG;
|
|
|
0a122b |
+ long k, lim = bits/BITS_PER_LONG;
|
|
|
0a122b |
|
|
|
0a122b |
for (k = 0; k < lim; ++k) {
|
|
|
0a122b |
dst[k] = ~src[k];
|
|
|
0a122b |
@@ -108,10 +108,10 @@ void slow_bitmap_complement(unsigned long *dst, const unsigned long *src,
|
|
|
0a122b |
}
|
|
|
0a122b |
|
|
|
0a122b |
int slow_bitmap_and(unsigned long *dst, const unsigned long *bitmap1,
|
|
|
0a122b |
- const unsigned long *bitmap2, int bits)
|
|
|
0a122b |
+ const unsigned long *bitmap2, long bits)
|
|
|
0a122b |
{
|
|
|
0a122b |
- int k;
|
|
|
0a122b |
- int nr = BITS_TO_LONGS(bits);
|
|
|
0a122b |
+ long k;
|
|
|
0a122b |
+ long nr = BITS_TO_LONGS(bits);
|
|
|
0a122b |
unsigned long result = 0;
|
|
|
0a122b |
|
|
|
0a122b |
for (k = 0; k < nr; k++) {
|
|
|
0a122b |
@@ -121,10 +121,10 @@ int slow_bitmap_and(unsigned long *dst, const unsigned long *bitmap1,
|
|
|
0a122b |
}
|
|
|
0a122b |
|
|
|
0a122b |
void slow_bitmap_or(unsigned long *dst, const unsigned long *bitmap1,
|
|
|
0a122b |
- const unsigned long *bitmap2, int bits)
|
|
|
0a122b |
+ const unsigned long *bitmap2, long bits)
|
|
|
0a122b |
{
|
|
|
0a122b |
- int k;
|
|
|
0a122b |
- int nr = BITS_TO_LONGS(bits);
|
|
|
0a122b |
+ long k;
|
|
|
0a122b |
+ long nr = BITS_TO_LONGS(bits);
|
|
|
0a122b |
|
|
|
0a122b |
for (k = 0; k < nr; k++) {
|
|
|
0a122b |
dst[k] = bitmap1[k] | bitmap2[k];
|
|
|
0a122b |
@@ -132,10 +132,10 @@ void slow_bitmap_or(unsigned long *dst, const unsigned long *bitmap1,
|
|
|
0a122b |
}
|
|
|
0a122b |
|
|
|
0a122b |
void slow_bitmap_xor(unsigned long *dst, const unsigned long *bitmap1,
|
|
|
0a122b |
- const unsigned long *bitmap2, int bits)
|
|
|
0a122b |
+ const unsigned long *bitmap2, long bits)
|
|
|
0a122b |
{
|
|
|
0a122b |
- int k;
|
|
|
0a122b |
- int nr = BITS_TO_LONGS(bits);
|
|
|
0a122b |
+ long k;
|
|
|
0a122b |
+ long nr = BITS_TO_LONGS(bits);
|
|
|
0a122b |
|
|
|
0a122b |
for (k = 0; k < nr; k++) {
|
|
|
0a122b |
dst[k] = bitmap1[k] ^ bitmap2[k];
|
|
|
0a122b |
@@ -143,10 +143,10 @@ void slow_bitmap_xor(unsigned long *dst, const unsigned long *bitmap1,
|
|
|
0a122b |
}
|
|
|
0a122b |
|
|
|
0a122b |
int slow_bitmap_andnot(unsigned long *dst, const unsigned long *bitmap1,
|
|
|
0a122b |
- const unsigned long *bitmap2, int bits)
|
|
|
0a122b |
+ const unsigned long *bitmap2, long bits)
|
|
|
0a122b |
{
|
|
|
0a122b |
- int k;
|
|
|
0a122b |
- int nr = BITS_TO_LONGS(bits);
|
|
|
0a122b |
+ long k;
|
|
|
0a122b |
+ long nr = BITS_TO_LONGS(bits);
|
|
|
0a122b |
unsigned long result = 0;
|
|
|
0a122b |
|
|
|
0a122b |
for (k = 0; k < nr; k++) {
|
|
|
0a122b |
@@ -157,10 +157,10 @@ int slow_bitmap_andnot(unsigned long *dst, const unsigned long *bitmap1,
|
|
|
0a122b |
|
|
|
0a122b |
#define BITMAP_FIRST_WORD_MASK(start) (~0UL << ((start) % BITS_PER_LONG))
|
|
|
0a122b |
|
|
|
0a122b |
-void bitmap_set(unsigned long *map, int start, int nr)
|
|
|
0a122b |
+void bitmap_set(unsigned long *map, long start, long nr)
|
|
|
0a122b |
{
|
|
|
0a122b |
unsigned long *p = map + BIT_WORD(start);
|
|
|
0a122b |
- const int size = start + nr;
|
|
|
0a122b |
+ const long size = start + nr;
|
|
|
0a122b |
int bits_to_set = BITS_PER_LONG - (start % BITS_PER_LONG);
|
|
|
0a122b |
unsigned long mask_to_set = BITMAP_FIRST_WORD_MASK(start);
|
|
|
0a122b |
|
|
|
0a122b |
@@ -177,10 +177,10 @@ void bitmap_set(unsigned long *map, int start, int nr)
|
|
|
0a122b |
}
|
|
|
0a122b |
}
|
|
|
0a122b |
|
|
|
0a122b |
-void bitmap_clear(unsigned long *map, int start, int nr)
|
|
|
0a122b |
+void bitmap_clear(unsigned long *map, long start, long nr)
|
|
|
0a122b |
{
|
|
|
0a122b |
unsigned long *p = map + BIT_WORD(start);
|
|
|
0a122b |
- const int size = start + nr;
|
|
|
0a122b |
+ const long size = start + nr;
|
|
|
0a122b |
int bits_to_clear = BITS_PER_LONG - (start % BITS_PER_LONG);
|
|
|
0a122b |
unsigned long mask_to_clear = BITMAP_FIRST_WORD_MASK(start);
|
|
|
0a122b |
|
|
|
0a122b |
@@ -212,10 +212,10 @@ void bitmap_clear(unsigned long *map, int start, int nr)
|
|
|
0a122b |
* power of 2. A @align_mask of 0 means no alignment is required.
|
|
|
0a122b |
*/
|
|
|
0a122b |
unsigned long bitmap_find_next_zero_area(unsigned long *map,
|
|
|
0a122b |
- unsigned long size,
|
|
|
0a122b |
- unsigned long start,
|
|
|
0a122b |
- unsigned int nr,
|
|
|
0a122b |
- unsigned long align_mask)
|
|
|
0a122b |
+ unsigned long size,
|
|
|
0a122b |
+ unsigned long start,
|
|
|
0a122b |
+ unsigned long nr,
|
|
|
0a122b |
+ unsigned long align_mask)
|
|
|
0a122b |
{
|
|
|
0a122b |
unsigned long index, end, i;
|
|
|
0a122b |
again:
|
|
|
0a122b |
@@ -237,9 +237,9 @@ again:
|
|
|
0a122b |
}
|
|
|
0a122b |
|
|
|
0a122b |
int slow_bitmap_intersects(const unsigned long *bitmap1,
|
|
|
0a122b |
- const unsigned long *bitmap2, int bits)
|
|
|
0a122b |
+ const unsigned long *bitmap2, long bits)
|
|
|
0a122b |
{
|
|
|
0a122b |
- int k, lim = bits/BITS_PER_LONG;
|
|
|
0a122b |
+ long k, lim = bits/BITS_PER_LONG;
|
|
|
0a122b |
|
|
|
0a122b |
for (k = 0; k < lim; ++k) {
|
|
|
0a122b |
if (bitmap1[k] & bitmap2[k]) {
|
|
|
0a122b |
--
|
|
|
0a122b |
1.7.1
|
|
|
0a122b |
|