lkml.org 
[lkml]   [2019]   [Mar]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] spi: work around clang bug in SPI_BPW_RANGE_MASK()
On Thu, Mar 07, 2019 at 11:56:07AM +0100, Arnd Bergmann wrote:

> Link: https://bugs.llvm.org/show_bug.cgi?id=38789

> #define SPI_BPW_MASK(bits) BIT((bits) - 1)
> -#define SPI_BIT_MASK(bits) (((bits) == 32) ? ~0U : (BIT(bits) - 1))
> -#define SPI_BPW_RANGE_MASK(min, max) (SPI_BIT_MASK(max) - SPI_BIT_MASK(min - 1))
> +#define SPI_BIT_MASK(bits) ((BIT((bits) - 1) << 1) - 1)
> +#define SPI_BPW_RANGE_MASK(min, max) (SPI_BIT_MASK(max) - (BIT((min) - 1) - 1))

Can we have a comment that this is for the clang warning please so
nobody goes in and simplifies the code?
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2019-03-07 12:24    [W:0.040 / U:1.348 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site