Thread (37 messages) 37 messages, 4 authors, 2023-07-20

Re: [PATCH v3 1/5] lib/bitmap: add bitmap_{set,get}_value()

From: Alexander Potapenko <glider@google.com>
Date: 2023-07-17 14:54:31
Also in: lkml

quoted
I remember that this construction may bring horrible code on some architectures
with some version(s) of the compiler (*).
Wow, even the trunk Clang and GCC seem to generate better code for
your version of this line: https://godbolt.org/z/36Kqxhe6j
Oh wait.
First, my Godbolt reproducer is incorrect, it is using sizeof(unsigned
long) instead of 8 * sizeof(unsigned long) for BITS_PER_LONG.
quoted
To fix that I found an easy refactoring:

                map[index] &= ~(GENMASK(nbits, 0) << offset));
Second, the line above should probably be:
  map[index] &= ~(GENMASK(nbits - 1, 0) << offset));

, right?

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help