lkml.org 
[lkml]   [2022]   [Jan]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 29/54] drivers/iio: replace bitmap_weight() with bitmap_weight_{eq,gt} where appropriate
On Sun, Jan 23, 2022 at 10:39:00AM -0800, Yury Norov wrote:
> drivers/iio calls bitmap_weight() to compare the weight of bitmap with
> a given number. We can do it more efficiently with bitmap_weight_{eq, gt}
> because conditional bitmap_weight may stop traversing the bitmap earlier,
> as soon as condition is met.

...

> int i, j;
>
> for (i = 0, j = 0;
> - i < bitmap_weight(indio_dev->active_scan_mask,
> - indio_dev->masklength);
> + bitmap_weight_gt(indio_dev->active_scan_mask,
> + indio_dev->masklength, i);
> i++, j++) {
> j = find_next_bit(indio_dev->active_scan_mask,
> indio_dev->masklength, j);

This smells like room for improvement. Have you checked this deeply?

--
With Best Regards,
Andy Shevchenko


\
 
 \ /
  Last update: 2022-01-24 13:48    [W:0.388 / U:1.116 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site