lkml.org 
[lkml]   [2017]   [Jun]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 3/3] bitmap: Use memcmp optimisation in more situations
On Wed, Jun 7, 2017 at 5:29 PM, Matthew Wilcox <willy@infradead.org> wrote:

> Commit 7dd968163f ("bitmap: bitmap_equal memcmp optimization") was
> rather more restrictive than necessary; we can use memcmp() to implement
> bitmap_equal() as long as the number of bits can be proved to be a
> multiple of 8. And architectures other than s390 may be able to make
> good use of this optimisation.

> - if (__builtin_constant_p(nbits) && (nbits % BITS_PER_LONG) == 0)
> + if (__builtin_constant_p(nbits & 7) && IS_ALIGNED(nbits, 8))
> return !memcmp(src1, src2, nbits / 8);

I'm not sure this is a fully correct change.
What exactly ' & 7' part does?
For me looks like you may just drop it.

--
With Best Regards,
Andy Shevchenko

\
 
 \ /
  Last update: 2017-06-12 01:20    [W:0.105 / U:0.848 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site