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