1ace9bad4SMark Rutlandcat <<EOF 2*9257959aSMark Rutland ${int} dec, c = raw_${atomic}_read(v); 3ace9bad4SMark Rutland 4ace9bad4SMark Rutland do { 5ace9bad4SMark Rutland dec = c - 1; 6ace9bad4SMark Rutland if (unlikely(dec < 0)) 7ace9bad4SMark Rutland break; 8*9257959aSMark Rutland } while (!raw_${atomic}_try_cmpxchg(v, &c, dec)); 9ace9bad4SMark Rutland 10ace9bad4SMark Rutland return dec; 11ace9bad4SMark RutlandEOF 12