^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) cat <<EOF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * ${arch}${atomic}_add_negative - add and test if negative
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * @i: integer value to add
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * @v: pointer of type ${atomic}_t
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * Atomically adds @i to @v and returns true
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) * if the result is negative, or false when
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) * result is greater than or equal to zero.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) static __always_inline bool
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) ${arch}${atomic}_add_negative(${int} i, ${atomic}_t *v)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) return ${arch}${atomic}_add_return(i, v) < 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) EOF