blob: 527adec89c3783dc55416720dd8665dd1531ae3b [file] [log] [blame]
cat <<EOF
static __always_inline ${ret}
${arch}${atomic}_dec_if_positive(${atomic}_t *v)
{
${int} dec, c = ${arch}${atomic}_read(v);
do {
dec = c - 1;
if (unlikely(dec < 0))
break;
} while (!${arch}${atomic}_try_cmpxchg(v, &c, dec));
return dec;
}
EOF