lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Wed, 20 Jan 2021 16:06:27 -0800 From: Yury Norov <yury.norov@...il.com> To: linux-m68k@...ts.linux-m68k.org, linux-kernel@...r.kernel.org, linux-sh@...r.kernel.org, linux-arch@...r.kernel.org Cc: Yury Norov <yury.norov@...il.com>, Geert Uytterhoeven <geert@...ux-m68k.org>, Yoshinori Sato <ysato@...rs.sourceforge.jp>, Rich Felker <dalias@...c.org>, Arnd Bergmann <arnd@...db.de>, Dennis Zhou <dennis@...nel.org>, Andrew Morton <akpm@...ux-foundation.org>, Wolfram Sang <wsa+renesas@...g-engineering.com>, David Sterba <dsterba@...e.com>, Andy Shevchenko <andriy.shevchenko@...ux.intel.com>, Stefano Brivio <sbrivio@...hat.com>, "Ma, Jianpeng" <jianpeng.ma@...el.com>, Wei Yang <richard.weiyang@...ux.alibaba.com>, Josh Poimboeuf <jpoimboe@...hat.com>, Rasmus Villemoes <rasmus.villemoes@...vas.dk> Subject: [PATCH 3/6] tools: sync bitops macro definitions with the kernel Signed-off-by: Yury Norov <yury.norov@...il.com> --- tools/include/linux/bitmap.h | 11 ----------- tools/include/linux/bitops.h | 11 +++++++++++ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/tools/include/linux/bitmap.h b/tools/include/linux/bitmap.h index 477a1cae513f..266a9291dd1f 100644 --- a/tools/include/linux/bitmap.h +++ b/tools/include/linux/bitmap.h @@ -19,17 +19,6 @@ int __bitmap_equal(const unsigned long *bitmap1, const unsigned long *bitmap2, unsigned int bits); void bitmap_clear(unsigned long *map, unsigned int start, int len); -#define BITMAP_FIRST_WORD_MASK(start) (~0UL << ((start) & (BITS_PER_LONG - 1))) - -#define BITMAP_LAST_WORD_MASK(nbits) \ -( \ - ((nbits) % BITS_PER_LONG) ? \ - (1UL<<((nbits) % BITS_PER_LONG))-1 : ~0UL \ -) - -#define small_const_nbits(nbits) \ - (__builtin_constant_p(nbits) && (nbits) <= BITS_PER_LONG) - static inline void bitmap_zero(unsigned long *dst, int nbits) { if (small_const_nbits(nbits)) diff --git a/tools/include/linux/bitops.h b/tools/include/linux/bitops.h index 5fca38fe1ba8..1c70919cb216 100644 --- a/tools/include/linux/bitops.h +++ b/tools/include/linux/bitops.h @@ -14,6 +14,17 @@ #include <linux/bits.h> #include <linux/compiler.h> +#define BITMAP_FIRST_WORD_MASK(start) (~0UL << ((start) & (BITS_PER_LONG - 1))) +#define BITMAP_LAST_WORD_MASK(nbits) (~0UL >> (-(nbits) & (BITS_PER_LONG - 1))) + +/* + * The static inlines below do not handle constant nbits==0 correctly, + * so make such users (should any ever turn up) call the out-of-line + * versions. + */ +#define small_const_nbits(nbits) \ + (__builtin_constant_p(nbits) && (nbits) <= BITS_PER_LONG && (nbits) > 0) + #define BITS_PER_TYPE(type) (sizeof(type) * BITS_PER_BYTE) #define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_TYPE(long)) #define BITS_TO_U64(nr) DIV_ROUND_UP(nr, BITS_PER_TYPE(u64)) -- 2.25.1
Powered by blists - more mailing lists