3
0
mirror of https://github.com/Qortal/Brooklyn.git synced 2025-02-12 10:15:54 +00:00

17 lines
452 B
Plaintext
Raw Normal View History

2021-05-27 00:09:36 +05:00
cat << EOF
/**
2021-10-02 21:09:28 +05:00
* arch_${atomic}_add_unless - add unless the number is already a given value
2021-05-27 00:09:36 +05:00
* @v: pointer of type ${atomic}_t
* @a: the amount to add to v...
* @u: ...unless v is equal to u.
*
* Atomically adds @a to @v, if @v was not already @u.
* Returns true if the addition was done.
*/
static __always_inline bool
2021-10-02 21:09:28 +05:00
arch_${atomic}_add_unless(${atomic}_t *v, ${int} a, ${int} u)
2021-05-27 00:09:36 +05:00
{
2021-10-02 21:09:28 +05:00
return arch_${atomic}_fetch_add_unless(v, a, u) != u;
2021-05-27 00:09:36 +05:00
}
EOF