Re: [PATCH 27/54] lib/bitmap: add bitmap_weight_{cmp, eq, gt, ge, lt, le} functions
From: Andy Shevchenko
Date: Mon Jan 24 2022 - 07:44:45 EST
- Next message: Peter Zijlstra: "Re: [PATCH v6 bpf-next 6/7] bpf: introduce bpf_prog_pack allocator"
- Previous message: Andy Shevchenko: "Re: [PATCH 27/54] lib/bitmap: add bitmap_weight_{cmp, eq, gt, ge, lt, le} functions"
- In reply to: Andy Shevchenko: "Re: [PATCH 27/54] lib/bitmap: add bitmap_weight_{cmp, eq, gt, ge, lt, le} functions"
- Next in thread: Peter Zijlstra: "Re: [PATCH 27/54] lib/bitmap: add bitmap_weight_{cmp, eq, gt, ge, lt, le} functions"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Mon, Jan 24, 2022 at 02:41:38PM +0200, Andy Shevchenko wrote:
> On Sun, Jan 23, 2022 at 10:38:58AM -0800, Yury Norov wrote:
...
> > + if (num > (int)nbits || num < 0)
>
> Wonder if
>
> if (abs(num) > nbits)
>
> would be sufficient.
Scratch it. Of course it won't work.
It may be other way around:
if ((unsigned int)num > nbits)
> > + return -num;
--
With Best Regards,
Andy Shevchenko
- Next message: Peter Zijlstra: "Re: [PATCH v6 bpf-next 6/7] bpf: introduce bpf_prog_pack allocator"
- Previous message: Andy Shevchenko: "Re: [PATCH 27/54] lib/bitmap: add bitmap_weight_{cmp, eq, gt, ge, lt, le} functions"
- In reply to: Andy Shevchenko: "Re: [PATCH 27/54] lib/bitmap: add bitmap_weight_{cmp, eq, gt, ge, lt, le} functions"
- Next in thread: Peter Zijlstra: "Re: [PATCH 27/54] lib/bitmap: add bitmap_weight_{cmp, eq, gt, ge, lt, le} functions"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]