[PATCH v2] powerpc: add setmaskedbits macros
Timur Tabi
timur at freescale.com
Fri Aug 17 01:27:31 EST 2007
Michael Ellerman wrote:
> And if you're going to the trouble of making a macro, why not make it a
> bit more useful and have it check that the value and the mask match, ie:
>
> (v & ~m == 0)
What should I do if it fails this check?
> Final random thought, you could make the size/endian an argument:
>
> #define setmaskedbits(a, v, m, s) out_##s((a), (in_##s(a) & ~(m) | (v))
Hmmm.... the only thing wrong with that is that it would allow be64 on a
32-bit platform (i.e. no __power64__ protection). But that's minor.
--
Timur Tabi
Linux Kernel Developer @ Freescale
More information about the Linuxppc-dev
mailing list