Re: [RFC][PATCH 23/24] atomic: Collapse all atomic_{set,clear}_mask definitions
From: Chris Metcalf <hidden>
Date: 2015-07-10 13:34:14
Also in:
lkml
From: Chris Metcalf <hidden>
Date: 2015-07-10 13:34:14
Also in:
lkml
On 7/10/2015 6:39 AM, Peter Zijlstra wrote:
On Fri, Jul 10, 2015 at 11:10:33AM +0200, Geert Uytterhoeven wrote:quoted
Hi Peter, On Thu, Jul 9, 2015 at 7:29 PM, Peter Zijlstra [off-list ref] wrote:quoted
--- a/include/linux/atomic.h +++ b/include/linux/atomic.h@@ -28,6 +28,23 @@ static inline int atomic_add_unless(atom #define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) #endif +#ifndef atomic_nand +static inline void atomic_nand(int i, atomic_t *v) +{ + atomic_and(~i, v);That sounds like a misnomer... Your NAND is "A & ~B", while my[*] NAND is "~(A & B)"? [*] https://en.wikipedia.org/wiki/NAND_logicRight you are.quoted
What about atomic_clear()? (Is atomic_bic() too ARM-centric?)atomic_and_not() ?
I've seen this as ANDN (as opposed to NAND). That's the name I used in the tilepro atomics as the thing that implements the bitmask clear operation. SPARC also has an "andn" instruction with this semantics. -- Chris Metcalf, EZChip Semiconductor http://www.ezchip.com