https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103090

--- Comment #1 from Thiago Macieira <thiago at kde dot org> ---
One more:

bool tsign3(std::atomic<int> &i)
{
    // any two or more bits, so long as the sign bit is one of them 
    // (or the compiler doesn't know what's in the variable)
    int bits = 1 | signbit; 
    return i.fetch_and(bits, std::memory_order_relaxed) & signbit;
}

Reply via email to