Sign in
android-kvm
/
linux
/
9257959a6e5b4fca6fc8e985790bff62c2046f20
/
.
/
scripts
/
atomic
/
fallbacks
/
fetch_add_unless
blob: c18b940153dfda9ec8c2e47fff85766e8ca3fd82 [
file
] [
log
] [
blame
]
cat
<<
EOF
static
__always_inline $
{
int
}
raw_$
{
atomic
}
_fetch_add_unless
(
$
{
atomic
}
_t
*
v
,
$
{
int
}
a
,
$
{
int
}
u
)
{
$
{
int
}
c
=
raw_$
{
atomic
}
_read
(
v
);
do
{
if
(
unlikely
(
c
==
u
))
break
;
}
while
(!
raw_$
{
atomic
}
_try_cmpxchg
(
v
,
&
c
,
c
+
a
));
return
c
;
}
EOF