On 11/12/2010 01:08 PM, Mathieu Desnoyers wrote:
* Paolo Bonzini ([email protected]) wrote:
These are useful to flip single bits.

I'm trying to figure out the semantic of these operations.

are they

uatomic_add / uatomic_or or uatomic_add_return / uatomic_or_return ?

They return the old value, consistently with their names (see also the test_uatomic.c change). There are three possibilities:

- return nothing

- return the old value

- return the new value

Return nothing can be useful because it can be optimized on x86 as "lock orl (mem), reg/imm". However, there are no other return-nothing atomic ops in uatomic_*.h so I decided not to provide this.

Returning the new value doesn't make sense for and/or since you cannot revert the operation (unlike uatomic_add which can be implemented from uatomic_add_return).

So I chose the second.

Paolo

_______________________________________________
ltt-dev mailing list
[email protected]
http://lists.casi.polymtl.ca/cgi-bin/mailman/listinfo/ltt-dev

Reply via email to