[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Minios-devel] [UNIKRAFT PATCH v4 13/16] include/uk: add prefix to BITMAP_(FIRST|LAST)_WORD_MASK
Signed-off-by: Yuri Volchkov <yuri.volchkov@xxxxxxxxx> --- include/uk/bitmap.h | 18 +++++++++--------- include/uk/bitops.h | 18 +++++++++--------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/include/uk/bitmap.h b/include/uk/bitmap.h index 23b1483..cf1f82d 100644 --- a/include/uk/bitmap.h +++ b/include/uk/bitmap.h @@ -46,7 +46,7 @@ uk_bitmap_fill(unsigned long *addr, const unsigned int size) memset(addr, 0xff, BIT_WORD(size) * sizeof(long)); if (tail) - addr[BIT_WORD(size)] = BITMAP_LAST_WORD_MASK(tail); + addr[BIT_WORD(size)] = UK_BITMAP_LAST_WORD_MASK(tail); } static inline int @@ -62,7 +62,7 @@ uk_bitmap_full(unsigned long *addr, const unsigned int size) } if (tail) { - const unsigned long mask = BITMAP_LAST_WORD_MASK(tail); + const unsigned long mask = UK_BITMAP_LAST_WORD_MASK(tail); if ((addr[end] & mask) != mask) return (0); @@ -83,7 +83,7 @@ uk_bitmap_empty(unsigned long *addr, const unsigned int size) } if (tail) { - const unsigned long mask = BITMAP_LAST_WORD_MASK(tail); + const unsigned long mask = UK_BITMAP_LAST_WORD_MASK(tail); if ((addr[end] & mask) != 0) return (0); @@ -96,7 +96,7 @@ uk_bitmap_set(unsigned long *map, unsigned int start, int nr) { const unsigned int size = start + nr; int bits_to_set = UK_BITS_PER_LONG - (start % UK_BITS_PER_LONG); - unsigned long mask_to_set = BITMAP_FIRST_WORD_MASK(start); + unsigned long mask_to_set = UK_BITMAP_FIRST_WORD_MASK(start); map += BIT_WORD(start); @@ -109,7 +109,7 @@ uk_bitmap_set(unsigned long *map, unsigned int start, int nr) } if (nr) { - mask_to_set &= BITMAP_LAST_WORD_MASK(size); + mask_to_set &= UK_BITMAP_LAST_WORD_MASK(size); *map |= mask_to_set; } } @@ -119,7 +119,7 @@ uk_bitmap_clear(unsigned long *map, unsigned int start, int nr) { const unsigned int size = start + nr; int bits_to_clear = UK_BITS_PER_LONG - (start % UK_BITS_PER_LONG); - unsigned long mask_to_clear = BITMAP_FIRST_WORD_MASK(start); + unsigned long mask_to_clear = UK_BITMAP_FIRST_WORD_MASK(start); map += BIT_WORD(start); @@ -132,7 +132,7 @@ uk_bitmap_clear(unsigned long *map, unsigned int start, int nr) } if (nr) { - mask_to_clear &= BITMAP_LAST_WORD_MASK(size); + mask_to_clear &= UK_BITMAP_LAST_WORD_MASK(size); *map &= ~mask_to_clear; } } @@ -216,7 +216,7 @@ uk_bitmap_weight(unsigned long *addr, const unsigned int size) retval += hweight_long(addr[i]); if (tail) { - const unsigned long mask = BITMAP_LAST_WORD_MASK(tail); + const unsigned long mask = UK_BITMAP_LAST_WORD_MASK(tail); retval += hweight_long(addr[end] & mask); } @@ -237,7 +237,7 @@ uk_bitmap_equal(const unsigned long *pa, } if (tail) { - const unsigned long mask = BITMAP_LAST_WORD_MASK(tail); + const unsigned long mask = UK_BITMAP_LAST_WORD_MASK(tail); if ((pa[end] ^ pb[end]) & mask) return (0); diff --git a/include/uk/bitops.h b/include/uk/bitops.h index 82399e1..a8476e5 100644 --- a/include/uk/bitops.h +++ b/include/uk/bitops.h @@ -50,8 +50,8 @@ #define UK_BITS_PER_LONG_LONG 64 -#define BITMAP_FIRST_WORD_MASK(start) (~0UL << ((start) % UK_BITS_PER_LONG)) -#define BITMAP_LAST_WORD_MASK(n) (~0UL >> (UK_BITS_PER_LONG - (n))) +#define UK_BITMAP_FIRST_WORD_MASK(start) (~0UL << ((start) % UK_BITS_PER_LONG)) +#define UK_BITMAP_LAST_WORD_MASK(n) (~0UL >> (UK_BITS_PER_LONG - (n))) #define BITS_TO_LONGS(n) howmany((n), UK_BITS_PER_LONG) #define UK_BIT_MASK(nr) \ (1UL << ((nr) & (UK_BITS_PER_LONG - 1))) @@ -105,7 +105,7 @@ uk_find_first_bit(const unsigned long *addr, unsigned long size) return (bit + ukarch_ffsl(*addr)); } if (size) { - mask = (*addr) & BITMAP_LAST_WORD_MASK(size); + mask = (*addr) & UK_BITMAP_LAST_WORD_MASK(size); if (mask) bit += ukarch_ffsl(mask); else @@ -127,7 +127,7 @@ uk_find_first_zero_bit(const unsigned long *addr, unsigned long size) return (bit + ukarch_ffsl(~(*addr))); } if (size) { - mask = ~(*addr) & BITMAP_LAST_WORD_MASK(size); + mask = ~(*addr) & UK_BITMAP_LAST_WORD_MASK(size); if (mask) bit += ukarch_ffsl(mask); else @@ -149,7 +149,7 @@ uk_find_last_bit(const unsigned long *addr, unsigned long size) bit = UK_BITS_PER_LONG * pos; addr += pos; if (offs) { - mask = (*addr) & BITMAP_LAST_WORD_MASK(offs); + mask = (*addr) & UK_BITMAP_LAST_WORD_MASK(offs); if (mask) return (bit + ukarch_flsl(mask)); } @@ -178,7 +178,7 @@ uk_find_next_bit(const unsigned long *addr, unsigned long size, bit = UK_BITS_PER_LONG * pos; addr += pos; if (offs) { - mask = (*addr) & ~BITMAP_LAST_WORD_MASK(offs); + mask = (*addr) & ~UK_BITMAP_LAST_WORD_MASK(offs); if (mask) return (bit + ukarch_ffsl(mask)); if (size - bit <= UK_BITS_PER_LONG) @@ -193,7 +193,7 @@ uk_find_next_bit(const unsigned long *addr, unsigned long size, return (bit + ukarch_ffsl(*addr)); } if (size) { - mask = (*addr) & BITMAP_LAST_WORD_MASK(size); + mask = (*addr) & UK_BITMAP_LAST_WORD_MASK(size); if (mask) bit += ukarch_ffsl(mask); else @@ -218,7 +218,7 @@ uk_find_next_zero_bit(const unsigned long *addr, unsigned long size, bit = UK_BITS_PER_LONG * pos; addr += pos; if (offs) { - mask = ~(*addr) & ~BITMAP_LAST_WORD_MASK(offs); + mask = ~(*addr) & ~UK_BITMAP_LAST_WORD_MASK(offs); if (mask) return (bit + ukarch_ffsl(mask)); if (size - bit <= UK_BITS_PER_LONG) @@ -233,7 +233,7 @@ uk_find_next_zero_bit(const unsigned long *addr, unsigned long size, return (bit + ukarch_ffsl(~(*addr))); } if (size) { - mask = ~(*addr) & BITMAP_LAST_WORD_MASK(size); + mask = ~(*addr) & UK_BITMAP_LAST_WORD_MASK(size); if (mask) bit += ukarch_ffsl(mask); else -- 2.18.0 _______________________________________________ Minios-devel mailing list Minios-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/minios-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |