Thread (10 messages) flat view 10 messages, 5 authors, 2007-08-16

Re: [PATCH v2] powerpc: add setmaskedbits macros

From: Timur Tabi <hidden>
Date: 2007-08-16 15:27:42

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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help