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