3
0
mirror of https://github.com/Qortal/Brooklyn.git synced 2025-01-31 07:12:18 +00:00
Brooklyn/scripts/atomic/fallbacks/try_cmpxchg
Scare Crowe 53f3b81e5a T3Q is a slut
Fuck him
2021-10-02 21:09:28 +05:00

12 lines
250 B
Plaintext

cat <<EOF
static __always_inline bool
arch_${atomic}_try_cmpxchg${order}(${atomic}_t *v, ${int} *old, ${int} new)
{
${int} r, o = *old;
r = arch_${atomic}_cmpxchg${order}(v, o, new);
if (unlikely(r != o))
*old = r;
return likely(r == o);
}
EOF