Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1272751 > unrolled thread
| Started by | Jia He <hejianet@gmail.com> |
|---|---|
| First post | 2015-11-19 03:40 +0100 |
| Last post | 2015-11-22 20:20 +0100 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 1/3] linux/bitmap: Move 2 mask macro to bitops.h Jia He <hejianet@gmail.com> - 2015-11-19 03:40 +0100
Re: [PATCH 1/3] linux/bitmap: Move 2 mask macro to bitops.h Andy Shevchenko <andy.shevchenko@gmail.com> - 2015-11-22 20:20 +0100
| From | Jia He <hejianet@gmail.com> |
|---|---|
| Date | 2015-11-19 03:40 +0100 |
| Subject | [PATCH 1/3] linux/bitmap: Move 2 mask macro to bitops.h |
| Message-ID | <qwniF-3dU-5@gated-at.bofh.it> |
This patch moves the mask macro to bitops.h and then the new introduced api in find_bit.c can use it. Signed-off-by: Jia He <hejianet@gmail.com> --- include/linux/bitmap.h | 3 --- include/linux/bitops.h | 4 ++++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h index 9653fdb..15524f6 100644 --- a/include/linux/bitmap.h +++ b/include/linux/bitmap.h @@ -172,9 +172,6 @@ extern unsigned int bitmap_ord_to_pos(const unsigned long *bitmap, unsigned int extern int bitmap_print_to_pagebuf(bool list, char *buf, const unsigned long *maskp, int nmaskbits); -#define BITMAP_FIRST_WORD_MASK(start) (~0UL << ((start) & (BITS_PER_LONG - 1))) -#define BITMAP_LAST_WORD_MASK(nbits) (~0UL >> (-(nbits) & (BITS_PER_LONG - 1))) - #define small_const_nbits(nbits) \ (__builtin_constant_p(nbits) && (nbits) <= BITS_PER_LONG) diff --git a/include/linux/bitops.h b/include/linux/bitops.h index 2b8ed12..b881028 100644 --- a/include/linux/bitops.h +++ b/include/linux/bitops.h @@ -24,6 +24,10 @@ #define GENMASK_ULL(h, l) \ (((~0ULL) << (l)) & (~0ULL >> (BITS_PER_LONG_LONG - 1 - (h)))) +/* For bitmap ops*/ +#define BITMAP_FIRST_WORD_MASK(start) (~0UL << ((start) & (BITS_PER_LONG - 1))) +#define BITMAP_LAST_WORD_MASK(nbits) (~0UL >> (-(nbits) & (BITS_PER_LONG - 1))) + extern unsigned int __sw_hweight8(unsigned int w); extern unsigned int __sw_hweight16(unsigned int w); extern unsigned int __sw_hweight32(unsigned int w); -- 2.5.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Andy Shevchenko <andy.shevchenko@gmail.com> |
|---|---|
| Date | 2015-11-22 20:20 +0100 |
| Message-ID | <qxIl3-85o-5@gated-at.bofh.it> |
| In reply to | #1272751 |
On Thu, Nov 19, 2015 at 4:31 AM, Jia He <hejianet@gmail.com> wrote: > This patch moves the mask macro to bitops.h and then the new introduced > api in find_bit.c can use it. Why API can't use GENMASK() instead? > > Signed-off-by: Jia He <hejianet@gmail.com> > --- > include/linux/bitmap.h | 3 --- > include/linux/bitops.h | 4 ++++ > 2 files changed, 4 insertions(+), 3 deletions(-) > > diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h > index 9653fdb..15524f6 100644 > --- a/include/linux/bitmap.h > +++ b/include/linux/bitmap.h > @@ -172,9 +172,6 @@ extern unsigned int bitmap_ord_to_pos(const unsigned long *bitmap, unsigned int > extern int bitmap_print_to_pagebuf(bool list, char *buf, > const unsigned long *maskp, int nmaskbits); > > -#define BITMAP_FIRST_WORD_MASK(start) (~0UL << ((start) & (BITS_PER_LONG - 1))) > -#define BITMAP_LAST_WORD_MASK(nbits) (~0UL >> (-(nbits) & (BITS_PER_LONG - 1))) > - > #define small_const_nbits(nbits) \ > (__builtin_constant_p(nbits) && (nbits) <= BITS_PER_LONG) > > diff --git a/include/linux/bitops.h b/include/linux/bitops.h > index 2b8ed12..b881028 100644 > --- a/include/linux/bitops.h > +++ b/include/linux/bitops.h > @@ -24,6 +24,10 @@ > #define GENMASK_ULL(h, l) \ > (((~0ULL) << (l)) & (~0ULL >> (BITS_PER_LONG_LONG - 1 - (h)))) > > +/* For bitmap ops*/ > +#define BITMAP_FIRST_WORD_MASK(start) (~0UL << ((start) & (BITS_PER_LONG - 1))) > +#define BITMAP_LAST_WORD_MASK(nbits) (~0UL >> (-(nbits) & (BITS_PER_LONG - 1))) > + > extern unsigned int __sw_hweight8(unsigned int w); > extern unsigned int __sw_hweight16(unsigned int w); > extern unsigned int __sw_hweight32(unsigned int w); > -- > 2.5.0 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ -- With Best Regards, Andy Shevchenko -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web