summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorisaki <isaki@NetBSD.org>2019-03-01 09:57:32 +0000
committerisaki <isaki@NetBSD.org>2019-03-01 09:57:32 +0000
commit0452103aaa07c955293c010e65311ed490729aec (patch)
tree08e834f1dcd96842114e45cefe5dc2ddd90efdff /common
parentfd4710dbfef7762faf9e25d7b59044a9008b8c7b (diff)
Fix return value. or_and_fetch should return new value.
Diffstat (limited to 'common')
-rw-r--r--common/lib/libc/atomic/atomic_or_16_cas.c4
-rw-r--r--common/lib/libc/atomic/atomic_or_8_cas.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/common/lib/libc/atomic/atomic_or_16_cas.c b/common/lib/libc/atomic/atomic_or_16_cas.c
index 260c1a57cf2..e31ef2e8b49 100644
--- a/common/lib/libc/atomic/atomic_or_16_cas.c
+++ b/common/lib/libc/atomic/atomic_or_16_cas.c
@@ -1,4 +1,4 @@
-/* $NetBSD: atomic_or_16_cas.c,v 1.3 2014/06/23 21:53:45 joerg Exp $ */
+/* $NetBSD: atomic_or_16_cas.c,v 1.4 2019/03/01 09:57:32 isaki Exp $ */
/*-
* Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@ or_and_fetch_2(volatile uint16_t *addr, uint16_t val, ...)
old = *addr;
new = old | val;
} while (atomic_cas_16(addr, old, new) != old);
- return old;
+ return new;
}
__strong_alias(__atomic_fetch_or_2,__sync_fetch_and_or_2)
diff --git a/common/lib/libc/atomic/atomic_or_8_cas.c b/common/lib/libc/atomic/atomic_or_8_cas.c
index 27e1e91fcfe..12d1b174a0b 100644
--- a/common/lib/libc/atomic/atomic_or_8_cas.c
+++ b/common/lib/libc/atomic/atomic_or_8_cas.c
@@ -1,4 +1,4 @@
-/* $NetBSD: atomic_or_8_cas.c,v 1.3 2014/06/23 21:53:45 joerg Exp $ */
+/* $NetBSD: atomic_or_8_cas.c,v 1.4 2019/03/01 09:57:32 isaki Exp $ */
/*-
* Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@ or_and_fetch_1(volatile uint8_t *addr, uint8_t val, ...)
old = *addr;
new = old | val;
} while (atomic_cas_8(addr, old, new) != old);
- return old;
+ return new;
}
__strong_alias(__atomic_fetch_or_1,__sync_fetch_and_or_1)