Thread (28 messages) 28 messages, 3 authors, 2021-03-12

Re: [PATCH 04/14] lib: introduce BITS_{FIRST,LAST} macro

From: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Date: 2021-02-18 22:52:37
Also in: linux-m68k, linux-sh, lkml

On 18/02/2021 05.05, Yury Norov wrote:
BITMAP_{LAST,FIRST}_WORD_MASK() in linux/bitmap.h duplicates the
functionality of GENMASK(). The scope of there macros is wider
than just bitmap. This patch defines 4 new macros: BITS_FIRST(),
BITS_LAST(), BITS_FIRST_MASK() and BITS_LAST_MASK() in linux/bits.h
on top of GENMASK() and replaces BITMAP_{LAST,FIRST}_WORD_MASK()
to avoid duplication and increase the scope of the macros.
Please include some info on changes in generated code, if any. When the
parameter to the macro is a constant I'm sure it all folds to a
compile-time constant either way, but when it's not, I'm not sure gcc
can do the same optimizations when the expressions become more complicated.

Rasmus
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help